I've got a WSS3 sharepoint site that requires windows authentication both in IIS and via the Sharepoint site. What I would like to do is in the case that a user does not provide valid AD credentials they are redirected to a custom error page.

This isn't forms-based authentication. They are challenged. In IE if I cancel I see a generic "401 UNAUTHORIZED" plain text response. If I attempt a log in then cancel I see a blank page.

I have looked into several options such as customErrors, httpModule interception (only saw examples for this after the user is authenticated or when anonymous access is allowed via IIS), IIS Url rewrites (didn't see how this could help).

[UPDATE] This article fixes the arrive then immediately cancelled when using the "Log on as a different user" option from within Sharepoint, but not when credentials are provided that are invalid, then cancelled or when hitting Sharepoint freshly and providing credentials:

Redirecting to custom 401 page when "Access denied" occures within an ASP.NET application with Windows authentication

1 Answer 1


One of the most common reasons you might experience a 401 error is that your browser's cache and cookies are out of date, preventing the authorization from successfully going through. If your browser isn't using valid authentication credentials (or any at all), the server will reject the request.

Regards, Peter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.