I have an asp.net application and I am trying to handle custom exception using Application_Error. It works nicely but I have new requirement to set the error data in Session obj
You could use the Cache and an appropriate naming strategy for your key, like this:
protected void Application_Error(object sender, EventArgs e)
{
HttpContext.Current.Cache["error:" + Session.SessionID] = Server.GetLastError();
Response.Redirect("Error.aspx");
}
in the Error.aspx page you ca read it like this:
var error = Cache["error:" + Session.SessionID];