异常: Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack
位置: Response.Redirect("Login.aspx");
执行上面的程序遇到异常,报错为“Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack”。
查到两种解决方案:
1. 因为我的 Response.Redirect() 是放在try...catch...块中的,把语句移出来可以运行了。
2. 或写成Response.Redirect("Login.aspx", false),也可以运行。
原因
Response.End 方法停止页的执行,并将该执行变换到应用程序的事件管线中的 Application_EndRequest 事件。 Response.End 后面的代码行将不执行。
Response.Redirect 异常
最新推荐文章于 2021-09-07 11:24:34 发布