SSRS Report Viewer - Report chart fails to display in IE11

非 Y 不嫁゛ 提交于 2019-12-01 06:32:38
crackhaus

The missing IterationId helped me find similar scenarios. It makes sense that the IterationId would fail in IE11 as in Chrome and Firefox since IE11 introduces itself as a Mozilla client. "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko"

Per this article by Devin Steinke on SQL Reporting Services - Viewer broken in Non-IE Browsers

In my Global.asax code behind I append the IterationId parameter only on the request for the ReportViewerWebControl blank.gif. It works in IE11 now and still works in FireFox, Chrome and older versions of IE.

You won't see an exception from fiddler anymore, and the result text displays the retrieval of a GIF, "GIF89a" in my case.

VB.NET:

Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
    Dim pathQuery = HttpContext.Current.Request.Url.PathAndQuery
    Dim url = HttpContext.Current.Request.Url.ToString().ToLower()

    If pathQuery.StartsWith("/Reserved.ReportViewerWebControl.axd") And Not url.Contains("iteration") Then

        Dim resourceStreamId = HttpContext.Current.Request.QueryString("ResourceStreamId")

        If IsNothing(resourceStreamId) Then Return

        If resourceStreamId.ToString().Equals("blank.gif", StringComparison.InvariantCultureIgnoreCase) Then
            Context.RewritePath(String.Concat(HttpContext.Current.Request.Url.PathAndQuery, "&IterationId=0"))
        End If

    End If
End Sub

C#:

void Application_BeginRequest(object sender, EventArgs e)
{
    // Bug fix for MS SSRS Blank.gif 500 server error missing parameter IterationId
    // https://connect.microsoft.com/VisualStudio/feedback/details/556989/
    if (HttpContext.Current.Request.Url.PathAndQuery.StartsWith("/Reserved.ReportViewerWebControl.axd") &&
     !String.IsNullOrEmpty(HttpContext.Current.Request.QueryString["ResourceStreamID"]) &&
        HttpContext.Current.Request.QueryString["ResourceStreamID"].ToLower().Equals("blank.gif"))
    {
        Context.RewritePath(String.Concat(HttpContext.Current.Request.Url.PathAndQuery, "&IterationId=0"));
    }
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!