Response.Redirect 异常

来源:互联网 发布:淘宝怎么开票 编辑:程序博客网 时间:2024/05/18 20:48
异常: 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 后面的代码行将不执行。
原创粉丝点击