Passing Session object to another page return null error
Hi, Im trying to pass a Crystal Report Document type object to another page through Session but it sending a null error message. The goal is to generate the report in PDF format which is already taken care by custom class helper Rpt2PDF. The helper works perfectly and tested working if the report will be viewed in the same page.
Report Builder
Code:
oRpt.SetDataSource(myDS)
Session("vwreport") = oRpt
ClientScript.RegisterStartupScript(Me.Page.GetType(), "", "window.open('vwreport.aspx' );", True)
Report Viewer
Code:
r = CType(Session("vwreport"), ReportDocument)
Try
_page_helper.Rpt2PDF(r)
Catch ex As Exception
Response.Write("<h2>Unable to load report. Please try again.</h2>")
Response.Write(ex.ToString)
End Try
Error
Code:
nable to load report. Please try again.
System.NullReferenceException: Object reference not set to an instance of an object. at CrystalDecisions.CrystalReports.Engine.ReportDocument.get_IsLoaded() at
Appreciate any help. Thanks in advance.