I know it is unreasonable for me to say this but AXD files and anything that has to do with them scares me. I say this because if something goes wrong with them usually you can’t do anything about it, it is part of the magic of Ajax and ASP.Net that you are not supposed to concern yourself with and you can’t usually fix even if you wanted to. It is like a black box that always works, and when said black box stops working you are just left in a state of utter helplessness asking yourself “Well what do I do now?!”
Well this is the first time I have been able to find a work around for an AXD related issue.
You run a report in a web application using the SSRS Report Viewer Control and unexpectedly to you you see a broken image icon under a horizontal line in your report (if you put one there, not sure if this happens any other time).
|I originally thought this was because of my Sub Report, but it is the line I placed above it.|
What was particularly irritating about this, is this only happens when I use Chrome! I am not sure why. So I right clicked on the broken image icon and selected Open image in a new tab.
I was presented with a nice Yellow Screen of Death as shown below.
I am a big believer in playing around with things that are broken already, it’s not like you are going to make it worse especially when it is the black box that is blowing up. So it is complaining that it doesn’t have an IterationId as a parameter in its QSP (Query String Parameters) right? Okay well add the #@$@ thing then. Why the hell isn’t it there to begin with, damn you black box must I do everything around here?
|If it is missing, then add it!|
So I simply added “&IterationId=0” to the end of the URL’s QSP
I pressed enter to refresh the page and blammo blank page which is what we want, we don’t want that stupid broken image icon (why the hell is that there anyhow?).
Here is what the URL looks like:
Notice it is missing the IterationId parameter
The Stupid Fix to the Stupid Problem
Okay well we just proved that this can be fixed just by giving the beast what it wants, it wants its binky, so we gave it its binky. “But how do we do that programmatically without causing issues?” Well it is easy actually, I was searching for all of this nonsense on google and I couldn’t find an answer to my problem in particular, I kept finding a similar issue about a “Blue Coat” which had a decent solution or a work around rather that I am using to fix this problem too (all credits and resources at the bottom).
In order to fix this problem we want to re-write the request every time, but only for chrome browsers and only in this particular case. Here are the steps:
- Go to your Global.asax code behind
- Add the following code snippet and add any other customization you might want to add.
void Application_BeginRequest(object sender, EventArgs e)
//The following code is a hack for stopping a broken image from magically appearing on SSRS reports in chrome
//where ever a line is used in the report.
Uri u = HttpContext.Current.Request.Url;
//If the request is from a Chrome browser
//AND a report is being generated
//AND there is no QSP entry named "IterationId"
if (HttpContext.Current.Request.Browser.Browser.ToLower().Contains("chrome") &&
HttpContext.Current.RewritePath(u.PathAndQuery + "&IterationId=0");
Run your code and viola, the broken image icon goes the hell away. Warning: I can’t guarantee this won’t introduce problems because I just solved this today, but hey, this is a good place to start.
Google Fu Results
https://www.google.com/search?q=Missing+URL+parameter%3A+IterationId – main search result
http://www.networksteve.com/enterprise/topic.php?TopicId=37516 – this exact article’s complaint!
http://stackoverflow.com/questions/705359/reportviewer-missing-url-parameter-name – a similar complaint
http://forums.asp.net/t/1118527.aspx – a similar complaint
http://csharp-matt.blogspot.com/2010/06/effects-of-bluecoat-proxy-on-aspnet.html – blue coat stuff
http://social.msdn.microsoft.com/Forums/en-HK/sqlreportingservices/thread/b44a0452-d71a-4e69-b7e0-af74b9f6bde7 – this exact article’s complaint with no answer
http://support.microsoft.com/kb/2120979 – the KB article with a supposed fix (I doubt it will work)
http://www.webdeveloper.com/forum/showthread.php?154780-Application_BeginRequest-in-Global.asax-not-working – URL Rewrite example