Asp.net defaultRedirect上的跟踪错误?
我在我的web.config中添加了以下内容:Asp.net defaultRedirect上的跟踪错误?,asp.net,Asp.net,我在我的web.config中添加了以下内容: <customErrors mode="RemoteOnly" defaultRedirect="~/Site/Statics/Eroare.aspx"> <error statusCode="404" redirect="~/Site/Index.aspx" /> </customErrors> 嗯,在Eroare.aspx页面上的Page_Load方法中,我尝试将导致此重
<customErrors mode="RemoteOnly" defaultRedirect="~/Site/Statics/Eroare.aspx">
<error statusCode="404" redirect="~/Site/Index.aspx" />
</customErrors>
嗯,在Eroare.aspx页面上的Page_Load方法中,我尝试将导致此重定向的错误打印到我的内部日志中,但Server.GetLastError为null
你知道为什么吗?或任何其他解决方案来获取异常
谢谢。关键是触发Global.asax文件中的错误
protected void Application_Error(object sender, EventArgs e)
{
Exception objErr = Server.GetLastError().GetBaseException();
string err = "Error Caught in Application_Error event\n" +
"Error in: " + Request.Url.ToString() +
"\nError Message:" + objErr.Message.ToString() +
"\nStack Trace:" + objErr.StackTrace.ToString();
EventLog.WriteEntry("Sample_WebApp",err,EventLogEntryType.Error);
//Server.ClearError();
//additional actions...
}
更多信息: