The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Internet Explorer and the Magic of Microsoft KB Article Q293792

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Scott Hanselman

Posts: 1031
Nickname: glucopilot
Registered: Aug, 2003

Scott Hanselman is the Chief Architect at Corillian Corporation and the Microsoft RD for Oregon.
Internet Explorer and the Magic of Microsoft KB Article Q293792 Posted: Sep 16, 2003 6:32 PM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Scott Hanselman.
Original Post: Internet Explorer and the Magic of Microsoft KB Article Q293792
Feed Title: Scott Hanselman's ComputerZen.com
Feed URL: http://radio-weblogs.com/0106747/rss.xml
Feed Description: Scott Hanselman's ComputerZen.com is a .NET/WebServices/XML Weblog. I offer details of obscurities (internals of ASP.NET, WebServices, XML, etc) and best practices from real world scenarios.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Scott Hanselman
Latest Posts From Scott Hanselman's ComputerZen.com

Advertisement

Seems like a lot of my posts lately have started with something like "Here's a weird IE bug" or "Here's something odd in .NET" but...

Here's a weird IE thing.  We do a lot of Check Imaging and Statement stuff here, so if someone wants to go online and get an image of a check, they can.  We often use Web Services to talk to a Check Imaging Server.  Most often we retrieve PNG, JPEG, or GIF.  Sometimes, however, the client wants an Adobe Acrobat PDF. 

We'll make the SOAP call, get a PDF then stream it directly to the user (You don't want to save these kinds of things, for security purposes). 

Enter bug/feature Q293792.  Not a lot seems to have been written about this, and not a lot of people seem to care, but apparently when opening a full ActiveX embedding window (to host Acrobat, etc) IE makes either THREE or TWO requests for the content.  This is apparently "by design" as URLMON and MSHTML have trouble communicating.  So, MSHTML sends a request to "sniff" for the MIME type to figure out what app to load. 

Other than being a bandwidth hog, this wouldn't be a big deal - except, when the generation/retrieval of a PDF is an expensive operation involving a WS call to the back end. (Wow, a production Web Service! Madness! Heresy! ;) )

What's interesting is that IE changes the UserAgent HTTP Header to "contype" during the probe, obstensibly so we can simple return the MIME/type and not the actual data.

So, we need to handle that...something like (in classic ASP "psuedo-code"):

  If Instr(1, UserAgent, "contype") > 0 Then
   'Just send the mime/type
   Response.ContentType = "application/pdf"
   Response.End
  End If

So, that's not too bad.  But, even the "Fixed" versions of IE still send TWO requests.  So, we want to detect the second request and not return the whole thing again. 

Here's the other ODD point.  For reasons unknown to me, IE doesn't include the Accept-Language header when making this second call, so, we have them use what has already been sent by saying "Not-Modifed":

  Dim Language
  Language = Request.ServerVariables("HTTP_ACCEPT_LANGUAGE")
  If Language = "" then
   Response.Clear
   Response.ContentType = "application/pdf"
   Response.AddHeader "Last-modified", "Mon, 01 Sep 1997 01:03:33 GMT"
   Response.Status = "304 Not Modified"
   Response.End
  End If

Ah, the fun of supporting older versions of IE.  I think we need an updated IE Roadmap. 

The future of browsing, dear readers, is up in the air, IMHO.

Read: Internet Explorer and the Magic of Microsoft KB Article Q293792

Topic: Web Data Administrator Previous Topic   Next Topic Topic: Building a Lightweight Message-Passing System using the FCL

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use