读书人

实现对网站异常的统计

发布时间: 2014-01-19 01:28:51 作者: rapoo

实现对网站错误的统计
在做一个实现IIS7的发布系统。想实现对于已发布网站发生错误的统计

ps: 5xx 4xx 3xx 2xx 1xx 统计这5种的次数
[解决办法]
我用的笨办法,在web.config里指定各种错误指向的页面,当然也可以只指向一个页面,带不同的参数。

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="500" redirect="Err01.aspx" />
<error statusCode="404" redirect="Err02.aspx" />
</customErrors>

然后每个错误页面打开的时候,写入错误日志表,就可以统计了。
[解决办法]
Global

Application_EndRequest

switch(Context.Response.StatusCode)

读书人网 >asp.net

热点推荐