I'm using localReport to print PDF (SQL REPORTVIEWER). It works fine on localhost. When I move the application to Production (64 bits windows 2008) it gives me an error. (see below)
I put the renderedbytes in a Session in USERCONTROL and I do window.open('Program1.aspx')...
In page load of Program1.aspx I try to retrieve the Session variable and process.... I think this statement cause the error "Response.BinaryWrite (...) etc".
It works on my local pc (Vista 32bits)...
Can someone please what the errors says? and How can I solve this on production??????
thank you..
USERCONTROL1.ASCX
byte[] renderedBytes;
renderedBytes = localReport.Render(
reportType,
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out warnings);
Session["report"] = Print.RenderReport(listEnt, Language);
PROGRAM2.ASPX
protected void Page_Load(object sender, EventArgs e)
{
string extension = "PDF";
Response.ContentType = "application/pdf";
// set the MIME type here
Response.AddHeader("content-disposition", "inline: filename=Test." + extension);
Response.BinaryWrite((byte[])Session["report"]);
Response.End();
}
Server Error in '/' Application. Object reference not set to an instance of an object. 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: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] System.Web.HttpResponse.BinaryWrite(Byte[] buffer) +13 ConfederatieBouw.CustomModules.Controle_InhoudingsPlicht.WebForm1.Page_Load(Object sender, EventArgs e) +191 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsync