Microsoft.ReportingServices.ReportViewerControl.WebForms version 150.1404.0 returns invalid HTML for Reserved.ReportViewerWebControl.axd?ResourceStreamID=Blank.gif

Alan Waiss 31 Reputation points
2020-10-22T16:44:23.957+00:00

The HTML returned by the reporting services viewer is missing the " at the end of the src attribute. It's resulting in:

<img src="/Reserved.ReportViewerWebControl.axd?Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=9bd48e896cff4dacbf5f8e7eef2e43bc&Mode=true&OpType=ReportImage&ResourceStreamID=Blank.gif ALT="Blank image"/>

This is causing the ResourceStreamID parameter to get the value "Blank.gif%20ALT%3D" instead of just "Blank.gif" which is resulting in a 404 error.

I'm using the Microsoft.ReportingServices.ReportViewerControl.WebForms package, version 150.1404.0 (the latest).

I'm not sure if it matters, but I'm rendering a report in local mode.

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,853 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Alan Waiss 31 Reputation points
    2020-12-08T15:40:51.53+00:00

    Yes, it is still an issue. The problem is in the NuGet package. If this isn't the place to report problems in code, could you please point me to the proper place for a bug report?

    2 people found this answer helpful.

  2. Alan Waiss 31 Reputation points
    2020-12-08T15:43:51.227+00:00

    For anyone else with the same issue, until Microsoft gives us a proper fix, I have a potential workaround. It's messy, though, because it looks like the HTML string is composed by the rendering engine, then sent to the HtmlTextWriter in one big chunk.

    In your .aspx.cs:

    protected override void Render( HtmlTextWriter writer )
    {
        if( Page.IsPostBack )
        {
            writer = new HtmlTextWriter_Fix( writer.InnerWriter );
        }
    
        base.Render( writer );
    }
    
    class HtmlTextWriter_Fix : HtmlTextWriter
    {
        public HtmlTextWriter_Fix( TextWriter writer ) : base( writer )
        {
        }
    
        public override void Write( string s )
        {
            if( s.Contains( "ResourceStreamID=Blank.gif ALT=\"Blank image" ) )
                s = s.Replace( "ResourceStreamID=Blank.gif ALT=\"Blank image", "ResourceStreamID=Blank.gif\" alt=\"No content" );//[awaiss] The length has to match or the resulting content won't be parsed correctly (not sure why)
    
            base.Write( s );
        }
    }
    
    2 people found this answer helpful.
    0 comments No comments

  3. Davin Mickelson 121 Reputation points
    2024-03-19T14:51:59.7+00:00

    I believe this bug has been around for 20 years now. It was not a problem with IE but is currently a problem with Edge, Chrome, Firefox, and Safari. Even further, I understand it even came along with the codebase with the newer Power BI Server for the classic-style paginated reports. These are reports created with the Power BI Report Builder. I believe these reports also use an RDL-derived language.

    It's a bug with the Line control. The Line control will display broken images before and after the line unless an InterationID is tacked onto the end of the URL, like this:
    &IterationId=0

    A report dev could switch out the used Line for a different control and add a border to one side to simulate a line.

    Check out the article AND the comments here:
    https://obscureproblemsandgotchas.com/uncategorized/ssrs-report-viewer-control-broken-image/

    Good luck.

    1 person found this answer helpful.

  4. ZoeHui-MSFT 34,581 Reputation points
    2020-10-23T02:49:29.777+00:00

    Hi @Alan Waiss ,

    I'm not familiar with develop.

    I did some online research for your reference, hope it will be helpful to you.

    https://stackoverflow.com/questions/45454067/tiny-boxes-appear-when-rendering-ssrs-reports-in-html-viewed-from-chrome

    https://stackoverflow.com/questions/13498696/reportviewer-showing-broken-images-in-chrome

    You may also raise the question to this forum for further help.

    https://forums.asp.net/191.aspx/1?SQL+Server+Reporting+Services

    Regards,

    Zoe


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.