My First SP2 Issue
Yep, I found my first 'bug' associated with XPSP2. But it wasn't a bug, just an interesting behaviour.
At my work we develop a web based reporting application. One of the features is to export the currently viewed report as a csv file. I needed to test an export, so I viewed a report and told it to export...and was promptly faced with a Javascript error.
I had a look at the Javascript, and there was nothing really wrong with it - but I do know that the request back to the web server for the export report is done in a hidden IFrame. 'Uh oh', thinks me, 'There's higher security applied to IFrames now. Bugger'.
I spent a couple of hours scouring SP2 documentation for a change in IE that might be effecting this, also scouring the advanced options and security settings, trying to figure it out. I won't bore you with the specifics, but I found the problem and fixed it right up in our source ASP files (yeah, classic ASP, not .net...*sigh* Worse still, they're in JScript). It was a bug in the code, which of course was not written by me, but a developer who's now left the company. Grrrr.
So, the results of my investigation is this: When you want to return a document stream as a download from your ASP code, you set the 'Content-Disposition' header on the reponse object, specifying the filename of the attachment.
Here's the before code:
Response.Expires = -1;
Response.ContentType = "text/csv";
Response.AddHeader("Content-Disposition", "filename=Report" + iReportID + ".csv;");
And here's the after code:
Response.Expires = -1;
Response.ContentType = "text/csv";
Response.AddHeader("Content-Disposition", "attachment; filename=Report" + iReportID + ".csv;");
See the difference? That one word: attachment. Yes, it's actually always supposed to have been there. It seems prior to XPSP2, IE was basically seeing the headers and saying 'well, you know, i can see what you meant, so close enough'.
And now it's being strict about it. I think this is a good thing, but man I was tearing my hair out for a while there! So if you ever click a link and expect a 'open or save' popup and you run SP2, try checking to see if the guy that used to work here now works for you *grin*.
Listening to: demons - fat boy slim feat. macy gray - (6:54)