I know it is unreasonable for me to say this but AXD files (HTTP Handlers) 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.

The Setup

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.

 

The Investigation

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.

 

The Experiment

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

Yahtzee!

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:

http://localhost/CMApp2/Reserved.ReportViewerWebControl.axd?ReportSession=3jix0j33jora41z330kzhw45
&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1
&ControlID=8daa5ebd5e88473bbeab2fbf71ac40af&OpType=ReportImage&ResourceStreamID=Blank.gif

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:

  1. Go to your Global.asax code behind
  2. 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") &&
  u.AbsolutePath.ToLower().Contains("reserved.reportviewerwebcontrol.axd") &&
  !u.Query.ToLower().Contains("iterationid"))
  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

16 Replies to “SSRS Report Viewer Control Broken Image Below Lines – Missing URL parameter: IterationId”

  1. I just had the same problem and searched for "ssrs missing image blank.gif" and google redirected me here.

    Thank you for taking the time to post this!

  2. Thanks a lot for this; your information was very helpful in tracking down the same issue I was having. In exchange, let me do you one better: Get rid of the error entirely!

    First, for reference, I'm using 10.0.0.0 of the ReportViewer control (ReportViewer 2010) and Visual Studio 2008 with SQL Server 2008 R2. I have error notification set up (so I receive an e-mail with every unhandled error), and I would receive a notification of this error although the end user would not see the error page, thanks to it being a call to an "image". This actually happens in FireFox, as well, but FireFox does not display the "broken image" icon that Chrome shows. (Other search results claimed this wasn't a problem in IE, so I didn't bother testing there.)

    The image in question is somehow related to the "Line" control within SSRS. For whatever reason, ReportViewer will insert a "blank" image after displaying a Line (I assume this is some sort of space or clearing mechanism); it also appears to only be the Line control, as I have encountered it nowhere else. However, as you discovered, the URL used to generate the image is broken within Chrome (and FireFox).

    Rather than create an exclusion for this particular error (something I considered doing, as well), I just removed each instance of the "Line" control and, voila, success! The broken icon and the error message both disappear. If you look at the image you posted with the broken icon, you'll see a line right above it; remove this line and you should see the same result.

    Sadly, I don't know how to keep the Line control *and* not have the error message. However, you can replicate the emulate by:
    -Using borders on the edges of tables and extending the height of the last row
    -Creating a TextBox 1px high and giving it a border

    So, while this is still a workaround and not a true solution, I feel it's a lot better than excluding error messages (which I always fear will lead to actual errors going unreported.)

    Cheers,
    Robert

    1. I have the same setup as you.

      Your solution is better than what I did. I introduced the possibility of unforeseen bugs by intercepting every request and searching for that information every time. Since it is for all requests, I am sure there is a negative cost associated with this technique. This is really my last resort kind of thing.

      When I get a chance to go back to my reports, I will see if I can fake a line like you suggested, that is a better fix than modifying my whole site to deal with one broken image icon in chrome/firefox.

      Thanks for the tips,

      Eli

  3. This works! This is my global.asx
    <%@ Application Inherits="Microsoft.ReportingServices.WebServer.Global" Language="C#" %>

    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("firefox") && u.AbsolutePath.ToLower().Contains("reserved.reportviewerwebcontrol.axd") && !u.Query.ToLower().Contains("iterationid"))
    HttpContext.Current.RewritePath(u.PathAndQuery + "&IterationId=0");
    }

    …and I DID have to add

    to my web.config. SSRS R2 2008

    1. Sorry I didn't think to add that bit in, I don't work with Casini or IIS Express, as a rule of thumb I only work with IIS directly period. It is for this reason, the express editions don't work like a real environment and leave out all kinds of important stuff as you have seen.

      Good catch though.

  4. The same issue happens in safari browser also.

    The fix works if the line drawn is black in color. If the line is white, its missing in the report, but not displaying the broken image.

  5. That's very interesting. My IE 11 users are gettnig stuck with a "Loading.." screen while IE9 and Firefox clients are error free.

    I didn't realize this was an image request. I can see in my server Event Viewer logs, that the error is related to ReportViewerWebControl.axd and the URL is missing it's parameter IterationId

    The IterationId makes me think that sometimes the image is used to create a visual identation that is wider and wider depending on my many levels deep the report rendering is at.. just guessing, as a developer who has done this sort of thing

  6. Well, funny thing is we don't use ReportViewer in an application but rather calling the report just using URL which of course uses the ReportViewer provided by SSRS thus the Global.asmx doesn't have any code behind since it's all dll on the ReportServer bin which we don't have the source code.

    1. Is it possible for you to trace all the traffic going back and forth using Fiddler? You might be able to figure more out there. Regarding the Global.asax, the only time that doesn't have an accompanying cs file, from my experience, is when you are working with a legacy Web Site (versus a Web Application) – in which case you can edit this info in the Web Site's settings somewhere (been a while, I don't remember where). If this problem is happening without a website at all, then I would say try figure out a way to intercept the URLs flying back and forth like I mentioned initially. There should be a way to play with this.

  7. Microsoft is slacking big time and charging heavy prices for half built products. There is no need to have none employees find alternate solutions for annoying things like this. They have big enough teams to deploy a solution within days if they wanted. Like mentioned in this page, “The Stupid Fix to the Stupid Problem”. Just venting, because after so many years, it’s the same pattern…they rarely listen to our feedback as users of their product and hardly ever deploy a fix to issues real world users find; and as developers we have become accustomed to fixing their issues. It shouldn’t be that way, even if we enjoy figuring things out, it’s wasting peoples time and health. — I get it, they can’t go around fixing every nit picky thing, but some of these issues are consistent enough that they should address it. Not address it two+ years later.

    Anyways, here’s one solution, so I at least contribute something:
    http://coffeestain-it.blogspot.com/2011/08/sql-reporting-services-viewer-broken-in.html

    1. I can’t disagree with you. I am currently using SSIS heavily and I am upset that after all these years SSIS still crashes Visual Studio very regularly. To top it off, every time MS releases a new Visual Studio version I have to wait what feels like almost two years for SSDT to be released and fully supported. Everytime they release a new version, they aren’t improving anything or adding new features. No quality of life changes, nothing. SSIS and SSRS are basically the same crappy products they have been since VS 2008. So I hear you and I agree with you, it’s irritating.

  8. I just installed the May 2020 Power BI report server and I’m using Visual Studio 2019 to deploy reports to it. This issue still exists…

Leave a Reply

Your email address will not be published. Required fields are marked *