Jeff Sanders Technical Blog

I am a Microsoft employee that has worked on all aspects of the Web Stack for a long time. I hope these blogs are useful to you! Use this information at your own risk.


Earlier Posts

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 is that there is a broker IE process and this kicks of the actual IE instance.  Look at the links at the end of the article for more information how this works.

The technique you can use is to iterate over the processes and wait for your expected IE instance to get a valid window handle.  If there are no other IE instances running the technique is relatively simple.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> Here is a simple console application you can debug and play with to investigate this technique.


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).


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.



You may get an error similar to this when running your WinHttp application:


First and foremost, this is NOT supported for reasons stated in this article: http://support.microsoft.com/default.aspx/kb/238425. Primarily, problems occur because of information that is stored in the HKEY_CURRENT_USERS registry key and because of threading concerns.  Furthermore, due to security implications and the design of WinInet in Windows 7, this absolutely will not work in Windows 7.  Finally, in Vista, there is a Low IL cache as well as the normal (Medium IL) cache so this sample is ineffective at best.  This blog entry is mearly an excercise to help you understand how the Registry works with thread impersonation as I discovered when working on a WinInet problem.


Because of RFC 2616 section 8.1.4 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html) we have traditionally limited the number of persistent connections to 2 per server.  This is because of the strong language in this RFC: ” A single-user client SHOULD NOT maintain more than 2 connections with any server or proxy.”<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” />


I came across this problem.  The key to this was that the documents opened fine when clicking on them, so I knew the Office installation itself was fine.  Some rogue application on install or removal had apparently removed the appropriate Content Type registry key so Internet Explorer was unable to associate the XML file extension with any application.  Restoring the default OS registry entry allowed everything to start functioning again.  Warning, modify the registry at your own risk.  Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk. <?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” />


This took me a couple of minutes to find so I thought I would share this here.


I like to build and run with UAC on.  When running the HttpCalculatorService example I got this error: 


These options are well documented.  Important notes:


The documentation on this is very straight forward (http://msdn.microsoft.com/en-us/library/aa385328(VS.85).aspx).  At the time of publishing however the documentation has a slight error.  You cannot pass a handle in for the first argument.  It must be NULL or the call will return false and GetLastError() will show the error is: ERROR\_INTERNET\_INVALID_OPERATION.