Hi!
I got error when I try to export the crystal report to pdf file :
Please help. this is the error :
Server Error in '/Web1' Application.
--------------------------------------------------------------------------------
Logon failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnExcept ion: Logon failed.
Source Error:
Line 92: End With
Line 93:
Line 94: myReport.Export()
Line 95: Response.ClearContent()
Line 96: Response.ClearHeaders()
Source File: C:\Inetpub\wwwroot\Web1\CRviewB.aspx.
vb Line: 94
Stack Trace:
[LogOnException: Logon failed.]
.K(String
, EngineExceptionErrorID )
.F(Int16 , Int32 )
.E(Int16 )
CrystalDecisions.CrystalReports.Engine.FormatEngin e.Export(ExportRequestContext reqContext)
CrystalDecisions.CrystalReports.Engine.FormatEngin e.Export()
CrystalDecisions.CrystalReports.Engine.ReportDocum ent.Export()
Web1.CRview1.btnExport_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\Web1\CRviewB.aspx.
vb:94
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()
------------------------------------------------------------------
this is my codes:
("Export" button)
Private Sub btnExport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExport.Click
Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
Dim myDiskFileDestinationOptions As CrystalDecisions.Shared.DiskFileDestinationOptions
Dim myExportFile As String
Dim myReport As New CrystalReport3()
myExportFile = "C:\Documents and Settings\winniewong\Desktop\" & _
Session.SessionID.ToString & ".pdf"
myDiskFileDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions ()
myDiskFileDestinationOptions.DiskFileName = myExportFile
myExportOptions = myReport.ExportOptions
With myExportOptions
.DestinationOptions = myDiskFileDestinationOptions
.ExportDestinationType = .ExportDestinationType.DiskFile
.ExportFormatType = .ExportFormatType.PortableDocFormat
End With
myReport.Export()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.Write(myExportFile)
Response.Flush()
Response.Close()
End Sub
Thanks.