Kar*_*nam 12 asp.net redirect boolean response.redirect
我有这个错误线程被中止.,今天下午在我的错误日志中.
导致此错误的代码是:
Response.Redirect("Login.aspx", true);
Run Code Online (Sandbox Code Playgroud)
如果我将bool值更改为false,则错误日志将变为空并且此错误将再次停止,但程序将停止工作.
如果我保持这样,我会得到这样的错误,如滋扰.
我想知道使用Response.Redirect传递true作为endResponse参数值的替代方法.
Col*_*kay 17
我抓住这个异常并吞下它,因为ASP.NET使用异常进行流控制而不是特殊情况.
try
{
// Do stuff.
}
catch(ThreadAbortException)
{
// Do nothing. ASP.NET is redirecting.
// Always comment this so other developers know why the exception
// is being swallowed.
}
catch(OtherExceptionTypes ex)
{
// Log other types of exception.
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16716 次 |
| 最近记录: |