Pages

Showing posts with label Redirect. Show all posts
Showing posts with label Redirect. Show all posts

Monday, May 16, 2011

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

Error "unable to evaluate expression because the code is optimized or a native frame is on top of the call stack" appears within asp.net using C#.

I noticed this error whenever I try to redirect to a page from within try catch block.

To fix this issue we need to use some extra code (marked in red color) within Response.Redirect method:

Response.Redirect("~/NewPage.aspx" , false);

Specifying whether the current page execution will end immediately or not.