Skip to Content

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

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Mar 21, 2017 at 09:31 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 22, 2017 at 04:37 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • Feb 24, 2017 at 02:17 PM

    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

    Add comment
    10|10000 characters needed characters exceeded