asp.net调试
2016-04-14 00:00
399 查看
1、将debug对象设定为true,然后进行调试,调试完毕可改为false,那么浏览器中就不会显示出错的位置。不过错误信息的提示与否还要和站点配置文件Global.asax配合使用,需要在该文件中添加错误处理函数,如:
void Application_Error(Object sender,EventArgs E)
{
//将错误信息显示出来
Response.Write(E.ToString);
//清楚错误
//Context.ClearError();
//跳转到指定页面
//Response.Redirect("/errorpage.aspx");
}
单个文件调试<% @page ...................debug="true"...>
还可以使用compilation标签 Web.Config文件中compilation标签来设定。
<compilation defaultLanguage="C#" Debug="true">
TRACE
使用Trace有两种方式
1、在网页的Page属性上加入Trace对象,如:
< % @ Page ..........trace="true"....... >
2、在相应的Web.Config文件中加入Trace对象,如:
<trace enabled="true" requestLimit="10" pageOutput="true" traceMode="SortByTime" localOnly="true"/>
void Application_Error(Object sender,EventArgs E)
{
//将错误信息显示出来
Response.Write(E.ToString);
//清楚错误
//Context.ClearError();
//跳转到指定页面
//Response.Redirect("/errorpage.aspx");
}
单个文件调试<% @page ...................debug="true"...>
还可以使用compilation标签 Web.Config文件中compilation标签来设定。
<compilation defaultLanguage="C#" Debug="true">
TRACE
使用Trace有两种方式
1、在网页的Page属性上加入Trace对象,如:
< % @ Page ..........trace="true"....... >
2、在相应的Web.Config文件中加入Trace对象,如:
<trace enabled="true" requestLimit="10" pageOutput="true" traceMode="SortByTime" localOnly="true"/>
相关文章推荐
- ASP MVC之参数传递
- ASP.NET MVC学习之母版页和自定义控件的使用
- ASP.Net 验证正则表达式
- 使用模板技术处理ASP.NET中GridView额外序号列的问题
- ASP.NET MVC Controller过滤器预处理表单数据
- ASP.NET性能优化小结(ASP.NET&C#)
- 26个ASP.NET常用性能优化方法
- ASP.NET网站的性能优化
- ASP.NET MVC ApiController过滤器预处理表单数据
- 修改Windows Server 2008+IIS 7+ASP.NET默认连接限制,支持海量并发连接数
- asp.net js 存取cookie
- 充分发挥异步在 ASP.NET 中的强大优势
- 充分发挥异步在 ASP.NET 中的强大优势
- ASP.NET MVC怎样引用你的model
- Spring框架 基于@Aspect的AOP配置(六)
- IIS中使用ASP.NET MVC的经验总结
- WIn10 尚未在 Web 服务器上注册ASP.NET 4.0
- HashMap和HaspTable的区别
- java.lang.OutOfMemoryError: Metaspace
- Asp.net mvc 创建一个带有集合的View