Elmah Mvc sending generated Id (ErrorId) to client

I am using Elmah.MVC in my project. I created this error handler to generate json response to the 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 this Id (ErrorId od db) which is automatically generated by elmah.

thank

+3


source to share





All Articles