7

I'm using ReportViewer 10.0. In Google Chrome, the lines come with a broken image called blank.gif. But IE and Firefox are working fine.

Here's an example with the images circled:

Screnshot

Any ideas on how to fix this?

KyleMit
  • 30,350
  • 66
  • 462
  • 664
Daniel
  • 2,780
  • 23
  • 21
  • There's [a seperate question for IE11](http://stackoverflow.com/q/21993721/419956) with the same root cause but totally different symptoms (IE11 just hangs). – Jeroen Feb 27 '15 at 14:02
  • Possible duplicate of [ReportViewer IE 11](https://stackoverflow.com/questions/21993721/reportviewer-ie-11) – KyleMit Jun 13 '18 at 22:09

6 Answers6

10

Just add the following CSS from SQL Reporting Services - Viewer broken in Non-IE Browsers:

body:nth-of-type(1) img[src*="Blank.gif"]{
    display:none;
}
KyleMit
  • 30,350
  • 66
  • 462
  • 664
Allen
  • 116
  • 2
  • 3
  • This also fixes it for Windows 10 Edge – Greg Aug 20 '15 at 21:51
  • Where exactly do you add this? can you provide screen shots or path, and once inside the .css file where inside it do you append it to? Just a bit more context would be helpful for those, like myself, who aren't as familiar but require this fix to be applied. – Goku Jun 09 '20 at 18:14
3

The current solution will mask the issue, but won't address the underlying problem, which is that when browsers besides IE are composing the request for the gif (which SSRS just uses to replace padding), they don't know to include the IterationId query string parameter.

As SQL Reporting Services Viewer broken in Non-IE Browsers points out, if you're using the ReportViewer, you can fix this in your application routing under Application_BeginRequest like this:

protected void Application_BeginRequest(object sender, EventArgs e)
{
    // Original fix credit to Stefan Mohr
    // Bug fix for MS SSRS Blank.gif 500 server error missing parameter IterationId
    // https://connect.microsoft.com/VisualStudio/feedback/details/556989/
    HttpRequest req = HttpContext.Current.Request;
    if (req.Url.PathAndQuery.StartsWith("/Reserved.ReportViewerWebControl.axd") &&
        !req.Url.ToString().ToLower().Contains("iteration") &&
        !String.IsNullOrEmpty(req.QueryString["ResourceStreamID"]) &&
        req.QueryString["ResourceStreamID"].ToLower().Equals("blank.gif"))
    {
        Context.RewritePath(String.Concat(req.Url.PathAndQuery, "&IterationId=0"));
    }
}
KyleMit
  • 30,350
  • 66
  • 462
  • 664
  • You can avoid the performance hit of `ToLower()` by using `IndexOf`: `req.Url.ToString().IndexOf("IterationId", StringComparison.OrdinalIgnoreCase) < 0` `ToLower()` creates a new string when it is called. – Darren Griffith Sep 28 '16 at 22:26
  • @D-Money, readability trumps micro optimizations - *always*. That said, you can do a case insensitive comparison without having to use index of by using [`String.Equals(a, b, StringComparison.OrdinalIgnoreCase)`](https://msdn.microsoft.com/en-us/library/t4411bks.aspx) – KyleMit Sep 29 '16 at 14:02
  • I agree about premature optimization. I thought it was worth a comment since this code runs on every request. Also, my code replaces the Contains code, not the Equals code. – Darren Griffith Oct 04 '16 at 20:45
1

Workaround: use rectangles/textboxes/tablix cells and only have one of their borders showing. Works on chrome. For the OP, he can add extra columns as spacers between the data columns and skip showing the border for those.

user3448451
  • 21
  • 1
  • 2
  • Thank you. It helped me. the Simplest Solution that I found was to not use Line. I was using Line for the formatting purpose and it was mentioned in your comment and some other articles that i read that in older version of report viewer, it search for padding and calls a blank image. So I replaced Line with Textboxes with making the Top of the Textbox solid. This resolved my issue. – Christina Sebastian Nov 25 '20 at 13:57
0

I had the same error with Reportviewer version 10 so I update to version 14, it solve the problem and get some enhancements, compelte guide here

Adrian
  • 7,745
  • 5
  • 28
  • 28
-1

In my case its response not working in test mode (Localhost), but I corrected and now it works , instead of putting " StartsWith " I put "Contains". It's the code:

Protected Sub Application_BeginRequest(sender As Object, e As EventArgs)
        ' Original fix credit to Stefan Mohr
        ' Bug fix for MS SSRS Blank.gif 500 server error missing parameter IterationId
        ' https://connect.microsoft.com/VisualStudio/feedback/details/556989/
        Dim req As HttpRequest = HttpContext.Current.Request
        If req.Url.PathAndQuery.Contains("/Reserved.ReportViewerWebControl.axd") AndAlso Not req.Url.ToString().ToLower().Contains("iteration") AndAlso Not [String].IsNullOrEmpty(req.QueryString("ResourceStreamID")) AndAlso req.QueryString("ResourceStreamID").ToLower().Equals("blank.gif") Then
            Context.RewritePath([String].Concat(req.Url.PathAndQuery, "&IterationId=0"))
        End If
    End Sub

Hope you help,

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
-1

As the other answers, I solved this problem adding the following code to my Global.asax file:

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");
}

But, maybe you had missed or don't have the Global.asax file, as happened to me. So select your solution and go to:

File > New > File > Web > C#/VB.Net > Global Application Class

Save it as Global.asax, paste the code and it will solve your problem.

mathias.horn
  • 241
  • 1
  • 8
  • 12