一:跟踪:
1.页面级:<%@ Page Language="C#" Trace="true" %> 在@Page 指令中添加,Trace="true"
2.应用程序级:
<system.web>
<trace enabled="true"/>
</system.web>
在web.config 中添加 <trace enabled="true"/>
二:输出调试信息:
在web.config 中添加 <compilation debug="true">
三:错误处理:
1,页面级:<%@ ErrorPage="~/ErrorForm.aspx" %>
2,应用程序级:
<customErrors defaultRedirect="ErrorForm.aspx" mode="On">
<error statusCode="404" redirect="NotFindForm.aspx"/>
</customErrors>
四:异常信息:
Global.asax
protected void Application_Error(object sender, EventArgs e)
{
Exception exctptionLast = Server.GetLastError();
//在这里自定义异常处理类。记录日志
}