Show report in PDF format

Stimulsoft Reports.NET discussion
Post Reply
rj123
Posts: 9
Joined: Fri Aug 02, 2013 9:30 am

Show report in PDF format

Post 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.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Show report in PDF format

Post 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.
rj123
Posts: 9
Joined: Fri Aug 02, 2013 9:30 am

Re: Show report in PDF format

Post 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
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Show report in PDF format

Post 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.
rj123
Posts: 9
Joined: Fri Aug 02, 2013 9:30 am

Re: Show report in PDF format

Post by rj123 »

Hi,

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

Thanks in Advance.
Attachments
BS_Horz_NoPC2.mrt
BS_Horz_NOPC
(134.68 KiB) Downloaded 293 times
Default2.aspx.cs
Deafult page
(26.69 KiB) Downloaded 204 times
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Show report in PDF format

Post 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.
Post Reply