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

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 so here is some sample code.


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?<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” />


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: http://msdn.microsoft.com/en-us/library/aa384714(VS.85).aspx.  As always, I like to see examples of how this flag works!


There can be many reasons for this error.  In some cases this error can be confusing.  I have seen a few instances where an ASP.Net webservice call resulted in this error.  More perplexing is the fact that Internet Explorer on the same machine can reach the WebService fine.  If a firewall was blocking the traffic, most likely the Internet Explorer request to the same port would also be blocked.  Also to add to the confusion is when adding the usesystemdefault=true (default setting) did the proxy not get used.  The reason that usesystemdefault did not get the proxy is that IE stores the hard coded proxy information in the registry of the logged on user.  When ASP.Net runs, it is not running in the context of the currently logged on user (normally) and so it cannot read the same information that IE is reading to connect to the proxy.


WinhttpTracecfg.exe for Vista does not exist, so how can you get a WinHttp trace in Vista and above?


I was messing with the latest samples in the RC for Win7 SDK (Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1: RC).

 

I build some of the WWSAPI samples and for the x86 platform, the samples would fail when I run them because of a missing dll.  Here is the error message I got:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

“The program can’t start because MSVCR90.dll is missing from your computer.


To understand these settings you need to understand how the HttpWebRequest class relates to the ServicePointManager and ServicePoint classes.  When you make a request with the HttpWebRequest class, the ServicePointManager provides a ServicePoint object to the HttpWebRequest object to handle the connection to a web resource (web server).  This ServicePoint object manages all the requests for a particular URI Host and protocol.  For example:  There will be one ServicePoint object for all the requests in my sample because they are all going to the server JSAN1 and using the HTTP protocol.  The ServicePoint object has some settings to control how it services the requests.  You can set the default values for these settings on the ServicePointManager before any ServicePoint objects are created.  Once the ServicePoint object is created these default values will not affect existing ServicePoint objects, only newly created ones.


The following code worked fine on IIS 6 but when used on IIS it failed:


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


Strange.  I found in my personal website the Child menus were not showing when I hovered over the root menu item.


<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><p style="MARGIN: 0in 0in 10pt" class=MsoNormal>Message: This Tab Has Been Recovered </p> <p style="MARGIN: 0in 0in 10pt" class=MsoNormal>Previous versions of IE are fine.</p> <p style="MARGIN: 0in 0in 10pt" class=MsoNormal>If the control implements IObjectSafety or other interfaces improperly, this could cause this message.


Further adventures with the WWSAPI Beta.  If you find this useful please take the time to Jot me a quick comment or note!