我有这样的代码:
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字符数组的长度无效。
at System.Web.UI.ObjectStateFormatter.Deserialize(String System.Convert.FromBase64String) at System.Web.UI.Util.DeserializeWithAssert(IStateFormatter inputString) at System.Web.UI.ObjectStateFormatter.Deserialize(String serializedState) at System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String inputString) at System.Web.UI.ObjectStateFormatter.Deserialize(String格式化程序,字符串serializedState) at System.Web.UI.HiddenFieldPageStatePersister.Load()
https://stackoverflow.com/questions/15835802
复制相似问题