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…


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:  uses Event Tracing for Windows (ETW) (ref:…


WinInet used in Thread Impersonation

First and foremost, this is NOT supported for reasons stated in this article: 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,…


Understanding Connection Limits and New Proxy Connection Limits in WinInet and Internet Explorer

Because of RFC 2616 section 8.1.4 ( 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.” Practically speaking with today’s modern web servers, there is…



These options are well documented.  Important notes: These flags affect the process that you set this option from.  You do not need to pass an InternetHandle (but no error if you do). Sample code: bool abRes = false;DWORD adOption = INTERNET_SUPPRESS_COOKIE_PERSIST;abRes= InternetSetOption(hInternet, INTERNET_OPTION_SUPPRESS_BEHAVIOR ,&adOption,sizeof(adOption));adOption = INTERNET_SUPPRESS_COOKIE_PERSIST_RESET;abRes= InternetSetOption(hInternet, INTERNET_OPTION_SUPPRESS_BEHAVIOR ,&adOption,sizeof(adOption));  


Understanding the new WinInet option: INTERNET_OPTION_MAX_CONNS_PER_PROXY

The documentation on this is very straight forward (  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.  The default value for this option…


Understanding the new WinInet option INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT

With the release of Internet Explorer 8 comes a new option you can query for with programming with the WinInet APIs: INTERNET_OPTION_SERVER_CERT_CHAIN_CONTEXT.  The MSDN documentation tells you it allows you to get the PCCERT_CHAIN_CONTEXT, and not much more.  It does not show you how to properly get the Context.  I like to see things in action…


Understanding the New WinInet flag: INTERNET_COOKIE_HTTPONLY

There are a couple of new Cookie flags introduced with the Internet Explorer 8 WinInet.dll.  The INTERNET_COOKIE_HTTPONLY flag allows you to read the HttpOnly cookies in your WinInet Code.  This flag is documented here:  As always, I like to see examples of how this flag works! Here is a sample ASPX page to create…


Understanding the New WinInet option: INTERNET_OPTION_SUPPRESS_SERVER_AUTH

With the release of Internet Explorer 8 comes a new option for WinInet programming: INTERNET_OPTION_SUPPRESS_SERVER_AUTH.  The MSDN documentation is very specific and describes how the option affects authorization, but I like to see things in action!  How about some sample code for INTERNET_OPTION_SUPPRESS_SERVER_AUTH? This option is documented here: (note that if you are not using the…


How to get Certificate Information Using WinInet APIs

There are two different structures you can query in order to retrieve server certificate information.  You must do some sort of request to complete the SSL server certificate exchange, and then you can retrieve this information.  Here is an example of that technique. C++ code listing for sample (Copy Code): // CertificateInfo.cpp : Defines the…