Asp.net 基础1(调试)
2010-05-11 00:22 c#在路上 阅读(305) 评论(0) 编辑 收藏 举报一:跟踪:
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();
//在这里自定义异常处理类。记录日志
}