All I need is just an error message in text form. But ASP.NET does output an HTML report from each error.
I have a jquery ajax call, and when an error occurs, I get all this shit on the client side.
I created a filter attribute but didn't help.
public class ClientErrorHandler : FilterAttribute, IExceptionFilter { public void OnException(ExceptionContext filterContext) { var responce = filterContext.RequestContext.HttpContext.Response; responce.Write(filterContext.Exception.Message); responce.ContentType = MediaTypeNames.Text.Plain; filterContext.ExceptionHandled = true; } }
EDIT
I see this
and I would like to see filterContext.Exception.Message located filterContext.Exception.Message
asp.net-mvc error-handling
user137348
source share