Elmah.ErrorHtmlPage.ProcessRequest C# (CSharp) Méthode

ProcessRequest() public méthode

public ProcessRequest ( System.Web.HttpContextBase context ) : void
context System.Web.HttpContextBase
Résultat void
        public void ProcessRequest(HttpContextBase context)
        {
            if (context == null) throw new ArgumentNullException("context");

            //
            // Retrieve the ID of the error to display and read it from 
            // the log.
            //

            var errorId = context.Request.QueryString["id"] ?? string.Empty;

            if (errorId.Length == 0)
                return;

            var log = ErrorLog ?? ErrorLog.GetDefault(context);
            var errorEntry = log.GetError(errorId);

            var response = context.Response;

            if (errorEntry == null)
            {
                // TODO: Send error response entity
                response.Status = HttpStatus.NotFound.ToString();
                return;
            }

            //
            // If we have a host (ASP.NET) formatted HTML message 
            // for the error then just stream it out as our response.
            //

            if (errorEntry.Error.WebHostHtmlMessage.Length == 0)
                return;

            response.Write(errorEntry.Error.WebHostHtmlMessage);
        }