How to iterate over contained controls to set a common event handler (Click) in .NET

The requirement was to assign a click event handler to all Label Controls contained in a .NET User Control.  This is a simple technique but I found there was no good documentation on how to do this.  To illustrate how to do this, I created a simple Windows Form application in C# and added a…

0

WinHttpWriteData will fail with ERROR_INVALID_PARAMETER if you are trying to send more data than specified in WinHttpSendRequest on Windows 7 (by design)

There are new checks in Windows 7 to prevent you from doing bad things with the WinHttp APIs.  In the sample code below, I do not get an error pre-Windows 7 but on Windows 7 the WinHttpWriteData call results in bResults being 0 and GetLastError() returns 87 (ERROR_INVALID_PARAMETER): LPSTR pszData = “WinHttpWriteData Example”; LPSTR pszMoreData…

0

How To: Walkthrough Using HttpListener or Http Server unmanaged code (C++) as an SSL Simple Server

There seems to be no simple end-to-end walkthrough for creating a simple HttpListener based SSL Listener that includes how to configure the computer by generating and installing a Certificate for this listener. Basic concepts covered: Write the listener code to listen for SSL requests Generate a self signed Certificate Configure the machine to use a…

12

How to get a dump for a System.Net.WebException using DebugDiag (Debug Diagnostics)

This information is available in the help file as well.  For more options please refer to the Help Documentation include with DebugDiag. Install the latest Debug Diagnostics from http://download.microsoft.com (search for Debug Diagnostics once on that site) Configure a crash rule for all w3wp.exe processes (if this dialog does not appear simply press the ‘Add…

0

Troubleshooting ASP.NET – The remote certificate is invalid according to the validation procedure

This error message is caused because the process is not being able to validate the Server Certificate supplied by the Server during an HTTPS (SSL) request.  The very first troubleshooting step should be to see if the server supplied certificate and every certificate in the chain is trouble free. Example 1 – Root Certificate only…

40

How to get the window handle for the Internet Explorer process you created (LCIE IE 8)

One technique people use in accessibility applications is to kick off an application and then grab the Window handle of the process to hook it or do other processing.  With loosely coupled Internet Explorer (LCIE) this is a little more difficult that simply getting the handle of the iexplore.exe process you kick off.  The reason…

2

Using HttpWebRequest with Credential Manager

A little know fact is that the .NET framework will use the stored credentials in the Credential Manager when accessing a network resource if the credentials exist for that particular resource (host).  I intend to clear up how this functionality works for the HttpWebRequests (you could extend this to WebService calls as well). In Internet…

7

Using netsh to analyze WinInet problems in Windows 7 and Windows 8

There are some powerful tracing tools built into Windows 7 that can help you diagnose Internet Client issues.  This walk though shows you now to enable tracing when accessing a web site using Internet Explorer 8 or other WinInet based applications. Network tracing in Windows 7 (ref: http://msdn.microsoft.com/en-us/library/dd569136(VS.85).aspx)  uses Event Tracing for Windows (ETW) (ref:…

3

Writing an ISAPI Filter with .NET (Managed Code) will result in poor performance of you ASP.NET web applications

David Wang wrote an excellent post about this in 2006:  http://blogs.msdn.com/david.wang/archive/2006/02/09/Can-I-write-an-ISAPI-Filter-using-Managed-Code.aspxThis includes writing ISAPI code that even USES managed components.  Anything that needs to load the CLR will result in poor performance of the ISAPI and worse, result in ASP.NET not functioning correctly.ASP.NET loads the CLR when it initializes.  During this loading it does many…

1

WinHttp Proxy configuration on Windows 2003 x64

You may get an error similar to this when running your WinHttp application: Error: The server name or address could not be resolvedCode: 80072EE7Source:  WinHttp.WinHttpRequest The familiar ProxyCfg application allows you to set the proxy settings for WinHttp.  However in this case, your  application is not picking up the proxy settings.  You verify this by setting the…

6