【发布时间】:2013-09-13 09:54:36
【问题描述】:
当我在 try catch 块中使用 response.redirect 方法时,我不希望线程中止异常。我给端的反应是真的。有什么方法可以代替抛出线程异常。该页面被重定向到登录页面。
这是我的代码,
try
{
Response.Redirect("login.aspx?fromLnkPg=1", true);
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
【问题讨论】:
-
我希望在 response.redirect 方法中结束响应属性为真。请提供任何可能的方式。
-
那很好。有没有可能的方法...我不想放两个catch块。
-
您想使用 Redirect 和 true 作为 endResponse 参数值,但您不想有两个 catch 块?那么你所要求的就是不可能的 - 你需要使用错误的两个 catch 块或完全放弃 Response.Redirect 以支持不同的重定向方式。