Quantcast
Channel: SCN : Discussion List - SAP Crystal Reports, version for Visual Studio
Viewing all articles
Browse latest Browse all 3636

Crystal Reports hangs indefinitely on refresh after export/print.

$
0
0

I'm using Crystal Reports for VS 13.09 on an IIS 7 server. The application works fine except for in this one scenario. I can print or export fine, and I can refresh fine, but if I print or export and then try to refresh the "Please wait while the document is being processed." box comes up and never goes away. After printing/exporting I can still use the breadcrumb links and forward/back buttons with no problems, it's just refresh that causes issues.

 

Here is the ASPX I'm using:

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewReport.aspx.cs" Inherits="Intranet.ViewReport" %>

 

<%@ Register Assembly="CrystalDecisions.Web, Version=14.0.3500.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

 

<!DOCTYPE html>

 

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <meta http-equiv="X-UA-Compatible" content="IE=9,chrome=1" /> 

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" Width="960px" HasRefreshButton="True" HyperlinkTarget="_blank" />

    </div>

    </form>

</body>

</html>

 

And here is the code:

 

using CrystalDecisions.Enterprise;

using CrystalDecisions.ReportAppServer.ClientDoc;

using IBM.Data.Informix;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

 

 

namespace Intranet

{

    public partial class ViewReport : System.Web.UI.Page

    {

        protected Connections sqlObj = new Connections();

        EnterpriseSession myEnterpriseSession;

        ReportClientDocument myReportDocument;

 

 

        protected void Page_Load(object sender, EventArgs e)

        {

            if (IsPostBack)

            {

                CrystalReportViewer1.ReportSource = (ReportClientDocument)Session["myReportDocument"];

            }

            else

            {

                BindingUsingReportAppFactory();

            }

        }

 

        void BindingUsingReportAppFactory()

        {

            try

            {

                Session["ReportPath"] = Request["ReportPath"];

                Session["Logon"] = Request["Logon"];

 

                myReportDocument = LoadReport(Session["ReportPath"].ToString());

                if (Request.UrlReferrer.ToString().Contains("/salesintranet.aspx"))

                {

                    string selectionText;

                    selectionText = myReportDocument.DataDefController.RecordFilterController.GetFormulaText();

 

                    if (selectionText != null)

                    {

                        int asteriskPos = selectionText.IndexOf('*');

                        if (asteriskPos > 0)

                        {

                            selectionText = selectionText.Substring(0, asteriskPos) + Session["Logon"] + selectionText.Substring(asteriskPos, selectionText.Length - asteriskPos);

                            myReportDocument.DataDefController.RecordFilterController.SetFormulaText(selectionText);

                        }

                    }

                }

 

                Session["myReportDocument"] = myReportDocument;

                CrystalReportViewer1.ReportSource = (ReportClientDocument)Session["myReportDocument"];

                LogReport('Y');

            }

            catch (Exception ex)

            {

                LogError(ex);

                LogReport('N');

                Response.Write("<html><body><h3>Request failed.</h3>");

                Response.Write("The document could not be loaded.<br />Please hit back to try again.<br />");

                Response.Write("If you are still unable to load the report, please contact IT.</body></html>");

                Response.End();

            }

        }

 

 

        ReportClientDocument LoadReport(string reportPath)

        {

            SessionMgr mySessionMgr = new SessionMgr();

            myEnterpriseSession = mySessionMgr.Logon("XXXX", "XXXX", "XXXX", "XXXX");

            EnterpriseService myEnterpriseService = myEnterpriseSession.GetService("InfoStore");

            InfoStore myInfoStore = new InfoStore(myEnterpriseService);

            myEnterpriseService = myEnterpriseSession.GetService("RASReportFactory");

            Object rrfObject = myEnterpriseService.Interface;

            ReportAppFactory myReportAppFactory = (ReportAppFactory)rrfObject;

 

            string query = "Select SI_ID from CI_INFOOBJECTS WHERE SI_NAME LIKE '" + reportPath + "'";

            InfoObjects myInfoObjects = myInfoStore.Query(query);

            InfoObject myInfoObject = myInfoObjects[1];

 

            return myReportAppFactory.OpenDocument(myInfoObject.ID, 0);

        }

 

Any suggestions on what might be the problem here?


Viewing all articles
Browse latest Browse all 3636

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>