給用戶一個統一的處理異常的方法是如下
1。修改web.config
修改完成后代碼如下
<customerrors mode="on"
defaultredirect="webform2.aspx"
/>
2。為全局響應,修改global.asax
if (server.getlasterror() is exception)
{
server.transfer("webform2.aspx");
}
3。代碼中拋出異常
throw new exception();
相當的簡單是吧
新聞熱點
疑難解答
圖片精選