全局应用类Application_Error触发事件问题。
我在Global.asax 里面的 Application_Error 做为出错的跳转。。。。为什么 前台如果调不到图片,或者调不到一个JS 文件。。 都会先触发一下这个事件呢? 怎么这么敏感。。。 --------------------编程问答-------------------- 是会的,只要是错误都会调用。
--------------------编程问答-------------------- private void application_Error(object sender, EventArgs e)
{
HttpApplication application = (HttpApplication)sender;
HttpContext context = application.Context;
context.Server.ClearError();
context.Response.Write( "错误,未找到文件 ");
context.Response.End();
}
--------------------编程问答-------------------- 捕捉所有页级别的错误处理程序中没有捕捉的所有错误信息 --------------------编程问答--------------------
protected void Application_Error(Object sender, EventArgs e)
{
string strError;
strError = Server.GetLastError( ).ToString( );
if (Context!= null)
Context.ClearError( );
Response.Write("Application_Error" + "
");
Response.Write("Error Msg: " + strError + "
" +
"End Error Msg
");
}
补充:.NET技术 , ASP.NET