SAP Crystal Reports Viewer does not display in browser

前端 未结 7 572
忘了有多久
忘了有多久 2021-02-02 04:48

I own a ASP.NET web project with framework 4.5. Is installed and implemented an SAP report for VS2012 Crystal Reports Developer.

Making in Local report, it works correct

7条回答
  •  孤城傲影
    2021-02-02 04:58

    For those of us running migrated projects from .Net 4.0 or lower to 4.5+ I have made an observation. It seems if your page that contains the viewer is in a subdirectory then the image urls are being generated relative to that page and not to the root of the web application. E.g if your page is /gl/accounts.aspx then the image may be /gl/crystalimagehandler.aspx etc A quick way to fix this is to change your handler mapping to a wildcard ending in crystalimagehandler.aspx or put the following code in Global.asax

    protected void Application_BeginRequest(object sender, EventArgs e)
            {
                var p = Request.Path.ToLower().Trim();
                if (p.EndsWith("/crystalimagehandler.aspx") && p!= "/crystalimagehandler.aspx")
                {
                    var fullPath=Request.Url.AbsoluteUri.ToLower();
                    var index = fullPath.IndexOf("/crystalimagehandler.aspx");
                    Response.Redirect(fullPath.Substring(index));
                }
            }
    

提交回复
热议问题