【发布时间】:2013-04-05 13:55:28
【问题描述】:
我有这个代码:
using System.Configuration;
void Application_Error(object sender, EventArgs e)
{
Exception ex = Server.GetLastError().GetBaseException();
string ErrorMessage = ex.Message;
string StackTrace = ex.StackTrace;
string ExceptionType = ex.GetType().FullName;
string UserId = Getloggedinuser();
string WebErrorSendEmail =
ConfigurationManager.AppSettings["WebErrorSendEmail"];
// save the exception in DB
LogStuffInDbAndSendEmailFromDb();
}
这是(大部分)我的代码。 不过,在少数情况下,我没有得到足够的信息。我不知道异常来自哪个页面。
如何获取与异常源自的页面相关的任何类型的信息?
以下是最短消息的示例:
Base-64 字符数组的长度无效。
在 System.Convert.FromBase64String(String s) at System.Web.UI.ObjectStateFormatter.Deserialize(字符串输入字符串)在 System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(字符串 序列化状态)在 System.Web.UI.Util.DeserializeWithAssert(IStateFormatter 格式化程序, 字符串序列化状态)在 System.Web.UI.HiddenFieldPageStatePersister.Load()
【问题讨论】:
标签: c# asp.net global-asax