Scott Hanselman

Internet Explorer and the Magic of Microsoft KB Article Q293792

September 16, '03 Comments [1] Posted in Web Services | PowerShell | Bugs
Sponsored By

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.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Switching [all] Providers...

September 16, '03 Comments [2] Posted in DasBlog | Diabetes
Sponsored By

Well, my Hanselman.com email (as well as for all my Hanselman relatives) has been down with DNS and dumb problems since Friday, so it's official.  I'm switching.  I'm switching to ORCSWeb.  I'll move all my domains there, including www.hanselman.com, www.diabeticbooks.com, www.glucopilot.com and www.computerzen.com.  Expect some weird DNS and silliness over the next few days, possibly this week.  I'm a huge believer in the permalink, so if I do it right, everything will work as before. 

After the dust has settled, I'll likely move from Radio to DasBlog.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Linux/J2EE causes colon cancer?

September 12, '03 Comments [0] Posted in Musings
Sponsored By

Wow...good thing I'm covered! ;)

A Forrester research project, funded by Microsoft inc., has determined that developing software using a Linux/J2EE development environment increases a developer's risk of dying from colon cancer by up to 40% over the risk when developing with Microsoft's .Net technology.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Rory asks, Why do I code?

September 11, '03 Comments [2] Posted in Web Services
Sponsored By

Why do I code?  Because I can't cook, or change my own oil, or mow lawns.  Because I lettered in drama in High School but I never got discovered walking an L.A. mall.  Because I never made any money doing standup.  Because, God help me, if I wasn't coding the only think I'd be good at would be selling cars.  (I'm REALLY good at selling cars.  Seriously.)

For real, I code because I like solving problems that are decidedly solvable.  I mean, I hear the problem, I think for a moment, I figure it's "possible" and then I try to figure how to solve it in a way that feels good.  Because I dig physics.  Because the end of the Carl Sagan's "Contact" was UNSPEAKABLY cool.  I code because of that feeling I've gotten 5 or 6 times when I just NAILED a problem and (while alone) raised my arms high in victory the same way that rapid sports fans do.  Except I look at them with a worried disdain when they do it, but secretly I wish I felt like that more often.

I code because coding, at its best, is art and literature and math and physics all at the same time.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Acquaintances, Buddies, Colleagues, Friends, Family, and Cousins

September 11, '03 Comments [0] Posted in ASP.NET
Sponsored By

I'm sitting on a plane from St. Louis to Orlando on the way to VSLive/ASPLive.  I was thinking about who I'm going to see at the conference.  I figure that my buddy Chris Kinsman will be there and possibly acquaintances of mine such as Keith Pleas.  Why just acquaintance?  I've had the pleasure to email Keith four or five times and I've met him four or five times, but when I see him I still lead with, "Keith! Scott Hanselman, how are you doing?" just in case Keith doesn't remember me, and this way he doesn't have to waste CPU cycles looking my face up.  I do the same thing with other acquaintances and "colleagues" like Chris Sells and Don Box and [Insert name here], et. al..  They are colleagues as I see them a few (sometimes several times) a year on campus or at conferences.  I say hi, but don't expect them to know my wife's name, since when you're holding all the WS-*.* specs in your head, sometimes you can't remember lots of trivial social details. 

So I got to thinking about the difference between "friend" and "colleague/acquaintance."  I have some remote friends, Patrick Hynds for example, who I chat with a few times a week and who could TOTALLY crash at our place on a moments notice.  We've shared (soft) drinks many times and have stories going back years.   But, I've only seen Patrick at conferences and on campus also.  Hell, I started to realize that I see Don Box more than I see my uncles (I see them on the 4th of July and at Christmas) and Don remembers my name better than my cousins! 

Therefore, I conclude that either:

A. I'm not nearly close enough to my family and need to spend more time with them instead of at conferences

or

2. Patrick, Keith, Don, ClemensChris, Chris, Sam and MANY others that I see several times a year are my REAL family and will not be surprised when I show up on their door wondering if I can sleep on their couch.

 Anyone else have this problem, or just me?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.