Global.asax - Application_Error - How can I get Page data? Global.asax - Application_Error - How can I get Page data? asp.net asp.net

Global.asax - Application_Error - How can I get Page data?


You can get the current request's URL and page like this :

void Application_Error(object sender, EventArgs e){    // Code that runs when an unhandled error occurs    if (HttpContext.Current != null)    {        var url = HttpContext.Current.Request.Url;        var page = HttpContext.Current.Handler as System.Web.UI.Page;    }}