Solved

Problem sharing crystal report on the web

Posted on 2007-11-14
3
257 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
3 Comments
 
LVL 100

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 500 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now