I'm writing a new IHttpModule. I would like to invalidate certain requests with 404 using a BeginRequest
event handler. How do I terminate the request and return a 404?
You can explicitly set the status code to 404 like:
HttpContext.Current.Response.StatusCode = 404;
HttpContext.Current.Response.End();
Response will stop executing.