Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ClientErrorHandler : FilterAttribute, IExceptionFilter
- {
- public void OnException(ExceptionContext filterContext)
- {
- var response = filterContext.RequestContext.HttpContext.Response;
- response.Write(filterContext.Exception.Message);
- response.ContentType = MediaTypeNames.Text.Plain;
- filterContext.ExceptionHandled = true;
- filterContext.Result = new HttpStatusCodeResult(HttpStatusCode.BadRequest);
- }
- }
Add Comment
Please, Sign In to add comment