On load of ASP.Net page, a report function is called.
protected void Page_Load(object sender, EventArgs e)
{
GlobalFunctions obj = new GlobalFunctions();
obj.GetReport(Page PageName, string ReportName);
}
GetReport is defined as :
public void GetReport(Page PageName, string ReportName)
{
ReportClass rpt = new ReportClass();
rpt = GetReportFromDLL(ReportName); //No error here
rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, ReportName);
}
Error :
"Response" is not accessible through the Class.
I have tried using "HttpContext.Current.Response" in place of "Response"
rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat,HttpContext.Current.Response, true, ReportName);
But I get this error:
"Unable to evaluate expression because the code is optimized or a
native frame is on top of the call stack."
Please help!
Best Answer
I'm not sure why you can't pass response to a function... Try following
And call as: