Thursday, November 8, 2012

SSRS Report Viewer Control Broken Image Below Lines - Missing URL parameter: IterationId

This post has moved along with the rest of this blog to WordPress please go to this link here: http://obscureproblemsandgotchas.com/uncategorized/ssrs-report-viewer-control-broken-image/

14 comments:

  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!

    ReplyDelete
    Replies
    1. No problem, I just hope there is a more permanent fix down the line with SSRS 2012.

      Delete
  2. Thanks. The force is strong in this one :)!

    ReplyDelete
  3. 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

    ReplyDelete
    Replies
    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

      Delete
  4. 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

    ReplyDelete
  5. The web.config bit to add is here: http://www.webdeveloper.com/forum/showthread.php?154780-Application_BeginRequest-in-Global.asax-not-working as above

    ReplyDelete
    Replies
    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.

      Delete
  6. 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.

    ReplyDelete
  7. 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

    ReplyDelete
  8. 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.

    ReplyDelete
    Replies
    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.

      Delete
  9. Great Solution.. Really Helped a lot. Thanks a ton

    ReplyDelete

Note: Only a member of this blog may post a comment.