Advertisement
Guest User

Untitled

a guest
Dec 10th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. private static void Filter404Errors(ExceptionFilterEventArgs args)
  2. {
  3. if (args.Exception.GetBaseException() is HttpException)
  4. {
  5. var httpException = args.Exception.GetBaseException() as HttpException;
  6. var path = ((HttpContext) args.Context).Request.Path;
  7. if (httpException != null && httpException.GetHttpCode() == 404 && (path.StartsWith("/images") || path.EndsWith(".jpg") ))
  8. args.Dismiss();
  9. }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement