Skip to Content
0

Bug: "document is being processed" modal dialog is not getting closed on HTTP Error

Feb 15, 2017 at 06:33 AM

805

avatar image
Former Member

We have come across a situation where "Please wait while the document is being processed." modal dialog is not getting closed when HTTP Request has failed.

Development Environment:

  1. ASP.Net with Target Framework 4.6.1
  2. Crystal Report 13.0.2000.0, Version: 13.0.19.2312
  3. Database Oracle
  4. IIS Server

Problem:

It was found many time that on navigation of pages or while report is being loaded, Crystal Report Viewer shows a modal dialog with message "Please wait while the document is being processed.". Said message will disappear on successful request from the server, but in many case like, Network failed, Server responded with HTTP error code or in any case where ajax request has failed to execute it, in such case this modal dialog box does not get closed and due to this user keep waiting to disappear this dialog but nothing happens, and user can not navigate, they will be forced to refresh the page or reopen the report.

Code:

ReportViewer.aspx
===================
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ReportViewer.aspx.cs" Inherits="ReportViewer" %>
<%@ Register TagPrefix="CR" Namespace="CrystalDecisions.Web" Assembly="CrystalDecisions.Web" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
<CR:CrystalReportViewer ID="ExternalCrystalReportViewer" runat="server"
            Height="1039px" 
            Width="901px" 
            ReuseParameterValuesOnRefresh="False" 
            HasRefreshButton="True" 
            HasCrystalLogo="False" 
            HasToggleParameterPanelButton="True" 
            ToolPanelView="ParameterPanel" 
            EnableDatabaseLogonPrompt="False"/>
    </div>
    </form>
</body>
</html>

ReportViewer.aspx.cs
====================
using System;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
using System.IO;


public partial class ReportViewer : System.Web.UI.Page
{
    private ConnectionInfo getconnetionInfo()
    {


        ConnectionInfo crConnectionInfo = new ConnectionInfo();
        crConnectionInfo.UserID = "user2";
        crConnectionInfo.Password = "user2";
        crConnectionInfo.ServerName = "ORCL";


        return crConnectionInfo;
    }
    protected void Page_Init(object sender, EventArgs e)
    {
    }
    
    protected void Page_Load(object sender, EventArgs e)
    {
        


        if (Session["rd"] == null)
        {
            try
            {
                ConnectionInfo crConnectionInfo = getconnetionInfo();


                
                string reportUrl = System.Web.HttpContext.Current.Server.MapPath("~/App_Data/" + "report-1.rpt");


                ReportDocument rd = new ReportDocument();
                rd.FileName = reportUrl;
                rd.Load(reportUrl, OpenReportMethod.OpenReportByTempCopy);
                rd.SetDatabaseLogon(crConnectionInfo.UserID, crConnectionInfo.Password);


                ExternalCrystalReportViewer.ReportSource = rd;                


                Session["rd"] = rd;
            }
            catch (Exception ex)
            {
                //Manage Exceptions
            }
        }
        else
        {
            ExternalCrystalReportViewer.ReportSource = (ReportDocument)Session["rd"];
        }




    }
}


Web.config
=========

<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <appSettings>
    <add key="CrystalImageCleaner-AutoStart" value="true"/>
    <add key="CrystalImageCleaner-Sleep" value="60000"/>
    <add key="CrystalImageCleaner-Age" value="120000"/>
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.6.1">
      <assemblies>
        <add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
        <add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
      </assemblies>
    </compilation>
    <sessionState mode="InProc" timeout="20"/>
  </system.web>
</configuration>

Steps to reproduce:

  1. Run the report in browser
  2. Possibly keep the data of two - three page so that you can navigate
  3. Once report is loaded, Stop the IIS Server, so that when you press next page, it can generate a HTTP Error
  4. if you see network log in Debug mode, request has already failed and returned but, "Please wait while the document is being processed." dialog is still executing and user can not navigate in the report due to modal view
  5. Actually, It should have informed user that last request has failed and you should try again.
  6. Please see the below image for reference

10 |10000 characters needed characters left characters exceeded
Former Member

Please readers and experts put your valuable comments & suggestion.

0
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
Don Williams
Mar 21, 2017 at 09:31 PM
0

CR expects the page and session to stay active. If it fails you need to handle it.

Others have used timers to ping the server to validate if the connection is still valid between client and server and keep the session active.

I believe the default timeout is 20 minutes, create a counter to keep the session active, if it fails then reconnect.

Don

Share
10 |10000 characters needed characters left characters exceeded
Don Williams
Feb 22, 2017 at 04:37 PM
0

Not a bug in CR, bug in your app logic...

See KBA 1215387 for an example on using Sessions and Postback to keep the report in Scope.

Postback will tell the user the session has expired or Server is no longer available etc.

Don

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thank you so much Mr.Don Williams for your valuable input. As you suggested KBA 1215387, we have programmed the same way, you can please check my code. Problem is not at server side, it is at CR's JavaScript file WebResource.axd : function WebForm_DoCallback. There is no handle for Ajax Failed Request.

Problem comes only when there is a error in Ajax Call, let say when we press refresh button, next or previous button and it will fire a Ajax call for the fetching a data from server, but during this period if Internet gets down or server has failed to response, the Dialog: "Document is being processed" will not close and will continue to display, as this dialog is modal window and it will not allow user to navigate further.

I request you to please check reproduce step.

Steps to reproduce:

  1. Run the report in browser
  2. Possibly keep the data of two - three page so that you can navigate
  3. Once report is loaded, Stop the IIS Server, so that when you press next page, it can generate a HTTP Error
  4. if you see network log in Debug mode, request has already failed and returned but, "Please wait while the document is being processed." dialog is still executing and user can not navigate in the report due to modal view
  5. Actually, It should have informed user that last request has failed and you should try again.
  6. Please see the image attached in question for reference

Below is the part of code as you suggested in, full code is mentioned in question.

//Option 1:
if(Session["rd"] == null){
//Loaded RD with all the inputs and set in session
ExternalCrystalReportViewer.ReportSource = rd;
 Session["rd"] = rd;
}
 else 
{
   ExternalCrystalReportViewer.ReportSource = (ReportDocument)Session["rd"];
}

//Option 2:
if(!Page.IsPostBack){
//Loaded RD with all the inputs and set in session
ExternalCrystalReportViewer.ReportSource = rd;
 Session["rd"] = rd;
}
 else 
{
   ExternalCrystalReportViewer.ReportSource = (ReportDocument)Session["rd"];
}

Please let me know if you need any input to reproduce this incidence.

Once again thank you very much for your valuable input, and awaiting your comment.

0
Don Williams
Feb 24, 2017 at 02:17 PM
0

Hi Vishal,

CR assumes it can talk to the Server and the Session is still valid, if either no longer exists you need to deal with that in the back end.

Check the Session State, a quick Google search for samples found a bunch.

If it's not active then reconnect or give the user the option to reconnect. Or if you need to you can simply ping the server session to keep it active and valid.

Continue using sessions and postback also...

Don

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Don,

I agree that CR assumes the connectivity and it expects a valid response from the server.

Now there are two part two this incidence:

  1. Server - Having Valid Session Object, Session State, Active and Ready to server a valid response if it receives any request from the Browser.
  2. Client Side - Browser

As I mentioned, My code at server side is all ready to server if it receives a next page request or any request from the client.

Now, at Client Side, Lets say user clicks next button, and we are running CR over the Internet.

Following is the sequence of call when we press next button in CR Viewer.

Call to CR JS File AllInOne.js
Call Stack: 
  _onNextPage()
    _request()
     this._ioHandler.request(G, this._name, F, E, B, A, C);
      bobj.crv.AspDotNetAdapte.request(pageState, viewerName, eventArgs, allowAsync, useIframe, callbackHandler, errbackHandler)
       WebResource.axd:function WebForm_DoCallback(eventTarget, eventArgument, eventCallback, context, errorCallback, useAsync)
        ...
        ...
        ...
        var callback = new Object();
        callback.eventCallback = eventCallback;
        callback.context = context;
        callback.errorCallback = errorCallback;
        callback.async = useAsync;
        ...
        ...
        ...
        //Something Missing like xmlRequest.onerror = function(){/*Error Handling*/}                                    
        xmlRequest.send(postData);

As we can see in the WebResource.axd : function WebForm_DoCallback, there is no error handling for network layer errors, and because of that even though server is ready to serve but as request has failed in between, CR is not handling this error and because of that "Please wait while the document is being processed." dialog is not getting closed. Request you to please try the reproduce steps to just check whether it needs to be addressed or not.

0
Former Member
Former Member

Please help how to manage this.

0