Redirect to IIS 401/403 error page in HttpModule?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to redirect to an IIS 401 or 403 error page by setting the
Response.StatusCode in an HttpModule?

Right now, my code look like:
e.Context.Response.StatusCode = 401;
e.Context.Response.End();

This passes back the proper headers, but fails to produce an error page on
the client side. Is it to late for IIS to respond with an error page, or do
we have to hook it up ourselves?
 
Yes, it's too late at that point. You could fake it by redirecting the user
to a page that doesn't exist.
 
Back
Top