?
Solved

Issues sending output of Crystal Reports to a browser

Posted on 2007-08-11
7
Medium Priority
?
286 Views
Last Modified: 2010-04-15
I have written an asp.net application (C#) which uses crystal reports to generate reports in excel, pdf, or rtf format.  It then sends these files to the browser for display.  This works perfectly on most machines, but every now and then the machines won't display the file.  Sometimes the browser beeps and closes the window AFTER opening a new window and downloading the file (even if all popup blockers are off)  My question is why, and how do I fix this?

Some other details... Solutions that have worked so far but are either not good enough or are unexplainable...

1) On most machines with this problem... unibstalling adobe and reinstalling fixes the problem for all 3 file types.  I understand why it fixes pdf, but....

2) If I set "always prompt for file download" under internet settings, the user gets a download dialog and can save it or even (sometimes) open it straight in this browser.  This works, but it makes the app inelegant.

Is there a better way?

PS.  Here is the C# code for display (which is basically a copy of suggested code from Business Object support)

private void ShowMyReport()
{
     string extension="";
     //Clear the response, so we can just send the file
    Response.Clear();
                  
    //Set up the format of the export
    switch (Session["ReportFormat"].ToString().Trim().ToUpper())
    {
          case "PDF":
                 Response.ContentType = "application/pdf";
                  Response.AppendHeader ("Content-Disposition", "Filename=Report.pdf");
                 extension = ".pdf";
                  break;
          case "XLS":
      Response.ContentType = "application/xls";
      Response.AppendHeader ("Content-Disposition", "Filename=Report.xls");
      extension = ".xls";
      break;                  
          case "RTF":
      Response.ContentType = "text/rtf";
      Response.AppendHeader ("Content-Disposition", "Filename=Report.rtf");
      extension = ".rtf";
      break;
}
                  
//Now set up where to get the file from.
string exportFileName = Session["ExportFileName"].ToString();
                  
//Dump the file to the web browser
Response.WriteFile(exportFileName);
Response.Flush();

//Now get rid of the pesky file off the server.
System.IO.File.Delete(exportFileName);
                  
   //Let the page display.
   Response.Close();
}
0
Comment
Question by:Miriam0000
  • 3
  • 2
5 Comments
 
LVL 9

Expert Comment

by:HappyFunBall
ID: 19679376
You might want to try getting rid of the Response.Close statement.  In my experience I've never used that statement and perhaps that is causing some issues.  For instance, it may be closing the response before some other code gets a chance to interact with it.

Otherwise your code looks right to me.
0
 
LVL 2

Author Comment

by:Miriam0000
ID: 19681455
That didn't do it.  I think it has t do with IE settings n the client but I can't figure out how to change them
0
 
LVL 9

Accepted Solution

by:
HappyFunBall earned 1500 total points
ID: 19683668
Your description of the 'beep' and window closing really does sound like a pop-up blocker.  Are you sure one isn't secretly running on some of these machines?  I've seen that happen with developers who forgot about the Google or Yahoo toolbar's popup blocker.

You could try running the page on a different browser to see if it really is IE related.  Load up Firefox on those machines that are having issues.

You may want to check Adobe's knowledgebase for help on why uninstalling and reinstalling makes a difference.  If it works, go with it.

In summary, I don't see anything wrong with your ASP.NET code.  And since this works on most machines, logically the issue is with the machine.  

You may have some luck posting this issue in the IE forum since it sounds like more of a browser configuration issue.  Sorry I can't help more than that.
0
 
LVL 9

Expert Comment

by:HappyFunBall
ID: 19683683
One last thing, since you mentioned "you can't figure out how to change [the IE settings]", are you in a position to use Group Policies to manage IE settings?  If it turns out a certain setting is causing an issue you can use GP or look into the IEAK7.0 to manage IE settings centrally.
0
 
LVL 2

Author Comment

by:Miriam0000
ID: 19686757
Thank you for your time and help.  I will try the IE forum and see where I get.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Loops Section Overview
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question