私はこのコードを持っています:
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) で System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) で System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) で System.Web System.Web.UI.HiddenFieldPageStatePersister.Load() の .UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState)