一个简单的页面异常处理
前几天接了个项目修改些功能。看了一下。 异常竟然直接写在页面上给用户看到。
1![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
try
3
{
4
this.Provider.OpenConnection();
5
6
Dtb=Topic.ListByArea(false,"CommunityForumTopic",this.AreaKey,
7
0,this.Provider.DBConnection,this.Row);
8
9
this.DataList2.DataSource=Dtb;
10
this.DataList2.DataBind();
11![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
12
}
13
catch(Exception ex)
14
{
15
Response.Write(ex.Message.ToString());
16
}
17![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
3
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
4
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
5
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
6
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
7
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
8
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
9
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
10
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
11
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
12
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
13
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
14
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
15
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
16
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
17
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
自己写了个简单的基类,在基类中抓异常。而且抓异常后不直接显示。按Crtl+Shift+M才把出错的异常显示出来。
有异常显示:
![](https://www.cnblogs.com/images/cnblogs_com/tingtang/aaa.gif)
按Crtl+Shift+M时显示:
![](https://www.cnblogs.com/images/cnblogs_com/tingtang/bbbb.gif)
原码下载:简单基类抓异常