Page 1 of 1

Show report in PDF format

Posted: Fri Aug 30, 2013 11:36 am
by rj123
Hi,

I am trying to open a report in PDF format using ResponseAsPdf.
The report showing in PDF format, but am also seeing the following error in exception
"Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack".

The code I am using to generate the report is as follows:

Code: Select all

report.Render();
StiWebViewer1.Report = report;
StiReportResponse.ResponseAsPdf(this.Page, report, false);
StiOptions.Web.AllowUseResponseFlush = false;
Please let me know how this error can be resolved.

Thanks.

Re: Show report in PDF format

Posted: Fri Aug 30, 2013 11:45 am
by Alex K.
Hello,

Please try to remove the following code:
StiWebViewer1.Report = report;

Only a viewer or exported PDF file can be placed on one page.
Thank you.

Re: Show report in PDF format

Posted: Fri Aug 30, 2013 12:14 pm
by rj123
Hi,
Even after removing the code 'StiWebViewer1.Report = report;', we are still seeing the same error.

What can we do now?
Any other code to be changed?

Thanks

Re: Show report in PDF format

Posted: Fri Aug 30, 2013 1:35 pm
by Vladimir
Hello,

Hard to say something on several lines of code. Please show the whole code of the page, or send us an archive with the project for the analysis.

Thank you.

Re: Show report in PDF format

Posted: Mon Sep 02, 2013 4:45 am
by rj123
Hi,

Please find attached the cs page and the report file.
Please let me know if any thing needs.

Thanks in Advance.

Re: Show report in PDF format

Posted: Mon Sep 02, 2013 2:10 pm
by Vladimir
Hello,

We've analyzed your code, we have a few recommendations:

1. Try to comment out the line:

Code: Select all

// StiOptions.Web.AllowUseResponseFlush = false; 
or place it before the ResponseAsPdf() method.

2. In the redirect methods, set the second parameter to false:

Code: Select all

Response.Redirect("......", false);
3. Try to set the StiOptions.Engine.FullTrust option to false:

Code: Select all

StiOptions.Engine.FullTrust = false;
Thank you.