3

I´m using Elmah.MVC on my project. I created that error handler to generate a json response to client :

public class OnHandleErrorAttribute : HandleErrorAttribute
{
    public override void OnException(ExceptionContext context)
    {
        // Ajax
        if (context.HttpContext.Request.IsAjaxRequest())
        {
            // Need create a Json result with generated Elmah error Id   ?!?
            // How can I get that Id?

            context.ExceptionHandled = true;
            context.HttpContext.Response.TrySkipIisCustomErrors = true;
            context.HttpContext.Response.StatusCode = error;
        }
        else
        {
            base.OnException(context);
        }
    }
}

I need that Id (ErrorId od db) that elmah generated automatically.

Thanks

Paul
  • 12,359
  • 20
  • 64
  • 101

0 Answers0