Wednesday, April 15, 2009

Response.Redirect exception in .NET 2.0

In .NET 2.0, using Response.Redirect gives an exception,
"Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack."

To solve the problem, use:
Response.Redirect ("Success.aspx", false)

or to end the response, write,
Response.Redirect ("Success.aspx", true)