try catch问题 急

来源:百度知道 编辑:UC知道 时间:2024/09/21 19:50:34
try
{
Server.Transfer(nextURL);
// Server.Transfer(@"~\WebPage\BusinessPage\0001\Default02.aspx");
}
catch(Exception ex)
{
ExceptionPage("PAGE_ERROR_00005", new string[] { nextURL });
}

为什么面页不跳转 而去执行ExceptionPage 如果我不要try,直接跳转可以
如果我直接跳转

server.transfer(nextURL)

只要这句,可以跳转

因为 Server.Transfer 这个事件,本身会引发一个 SERVER 的 HTTP 异常,此异常不会影响页面的正常跳转,但是可以捕获到

所以就发生了你的问题

对 Server.Transfer 不要进行异常捕获