Hi,
In my asp.net application i have developed some functionality which was working fine until I added try catch block. The issue is when Response.Redirect("URL"); is getting executed there occurs System.Threading.ThreadAbortException with message "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack".
The reason for this exception is because Response.Redirect, when called with just the URL, or with the URL and a Boolean value of true, calls the Response.End method. Response.End then calls Thread.Abort on the current thread which will result in ThreadAbortException.
So the best solution is to call redirect like Response.Redirect("URL",false) or after try catch block...
Regards
Fauzi
Blog from a software professional, Passionate to work in latest cutting edge technologies in order to get better results in business.
Showing posts with label Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack. Show all posts
Showing posts with label Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack. Show all posts
Subscribe to:
Posts (Atom)