• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 268
  • Last Modified:

Problem sharing crystal report on the web

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
mgmhicks
Asked:
mgmhicks
1 Solution
 
mlmccCommented:
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
 
stcindiaCommented:
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
 
mgmhicksAuthor Commented:
You  are the man.  Worked like a champ.  thank you stcindia:
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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now