Click here to Skip to main content
15,923,051 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
while generating report in excel method ExportToHttpResponse() gives exception

unable to evaluate expression because the code is optimized or a native frame is on top of the call stack .
Posted

In place of Response.End you have to use HttpContext.Current.ApplicationInstance.CompleteRequest method to bypass the code execution to the Application_EndRequest event.

Look here for details: Microsoft Support: ThreadAbortException Occurs If You Use Response.End, Response.Redirect, or Server.Transfer[^]
 
Share this answer
 
Comments
Prasad_Kulkarni 15-May-12 2:33am    
Good links +5!
Sandeep Mewara 15-May-12 12:07pm    
Thanks Prasad.
Please refer similar discussion:

Click here 1[^]
Click here 2[^]
Click here 3[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900