Global.asax - Application_Error - Como posso obter dados da página?
Eu tenho este código:
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();
}
Este é (a maior parte) meu código. Em uma pequena porcentagem de casos, não recebo informações suficientes. Não sei de que página a exceção foi originada.
Como posso obter qualquer tipo de informação relacionada à página da qual a exceção se originou?
Abaixo está um exemplo da mensagem mais curta:
Comprimento inválido para uma matriz de caracteres Base-64.
em System.Convert.FromBase64String (String s) em System.Web.UI.ObjectStateFormatter.Deserialize (String inputString) em System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize (String serializedState) em System.Web .UI.Util.DeserializeWithAssert (formatador IStateFormatter, String serializedState) em System.Web.UI.HiddenFieldPageStatePersister.Load ()