Developer Forum »
Retrieving the last error on friendly error page
58 posts

Is there any way to get the actual exception/error on a friendly error page? I'm using an article and would like to get a hold of the actual error.

120 posts

Details about the error is logged and available in the Error log. The details of the error is also available in the request paramaters of the error page. See this code for details:

 

                switch (site.WAFFriendlyErrorPageUrl.LinkType) {
                    case LinkType.InternalContent:
                        app.Response.Redirect(site.WAFFriendlyErrorPageUrl.GetUrl() + "?ErrorCode=500&ErrorMessage=" + HttpUtility.UrlEncode(errorMessage) + "&Url=" + HttpUtility.UrlEncode(WAFContext.GetFullOriginalUrl()));
                        break;
                    case LinkType.ExternalAddress:
                        app.Response.Redirect(site.WAFFriendlyErrorPageUrl.GetUrl() + "?ErrorCode=500&ErrorMessage=" + HttpUtility.UrlEncode(errorMessage) + "&Url=" + HttpUtility.UrlEncode(WAFContext.GetFullOriginalUrl()));
                        break;
                    case LinkType.Email:
                        app.Response.Redirect(site.WAFFriendlyErrorPageUrl.GetUrl() + "?Body=" + HttpUtility.UrlEncode(errorMessage));
                        break;
                    case LinkType.Empty:
                        WAFContext.ReturnPage(site.GetWAFFriendlyErrorTitle(httpCode), errorMessage, false, true);
                        break;
                    default:
                        break;
                }

 

 
 
1