?
Solved

Problem sharing crystal report on the web

Posted on 2007-11-14
3
Medium Priority
?
264 Views
Last Modified: 2012-06-21
I am using the following code to create a crystal reports that shows up in a web browser as a pdf. file.  Works great.  Except for the fact that its a web program and when I try and have mulitple people get a report, It must be creating the same temp pdf or something, cause It says the file is being used by another process.   Can someone look at the code below and figure out how to fix this problem.  Thanks

crDiskfilelocation = New DiskFileDestinationOptions
        Fname = ConfigurationSettings.AppSettings("ReportPath") & Session.SessionID.ToString & ".pdf"
        crDiskfilelocation.DiskFileName = Fname
        crExportOptions = crReport.ExportOptions
        With crExportOptions
            .DestinationOptions = crDiskfilelocation
            .ExportDestinationType = ExportDestinationType.DiskFile
            .ExportFormatType = ExportFormatType.PortableDocFormat
        End With
        crReport.Export()
        System.Diagnostics.Process.Start(Fname)
        'crViewer.ReportSource = crReport
        'crViewer.PrintMode = CrystalDecisions.Web.PrintMode.Pdf
        Response.ClearContent()
        Response.ClearHeaders()
        Response.ContentType = "application/pdf"
        Response.WriteFile(Fname)
        Response.Flush()
        Response.Close()
0
Comment
Question by:mgmhicks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 20284344
Not sure how to di it in .Net but in VB6 we had to cleanup the report objects.

Set crReprot = Nothing

Which edition of Crystal do you have?  

How did you install it on the web server?

mlmcc
0
 
LVL 4

Accepted Solution

by:
stcindia earned 2000 total points
ID: 20287891
May be you can directly write to memorystream and send to the browser so no need to specify file name

Below is partial sample code

                Dim mem As MemoryStream
                mem = crReport.ExportToStream(ExportFormatType.PortableDocFormat)
                Response.Clear()
                Response.Buffer = True
                Response.ContentType = "application/pdf"
                Response.BinaryWrite(mem.ToArray)
                Response.End()
0
 

Author Comment

by:mgmhicks
ID: 20289258
You  are the man.  Worked like a champ.  thank you stcindia:
0

Featured Post

Major Serverless Shift

Comparison of major players like AWS, Microsoft Azure, IBM Bluemix, and Google Cloud Platform

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

801 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