Prioritise Windows Authentication over Anonymous Authentication in IIS

asp.netiisiis-7.5

I've seen other answers saying how to secure virtual folders for Windows Authentication only. I would like to allow both anonymous AND Windows Authentication in IIS, but prioritise Windows Authentication over Anonymous Authentication. The reason for this is that the web app I am building needs to support anonymous access as well as privileged.

Is this possible? I.e. if Windows Authentication cannot authenticate against the domain, it will fall back to a generic identity, as opposed to the way it works out of the box by favouring anonymous access.

Developing on W7 with IIS.

Best Answer

You could do the steps in this article: http://msdn.microsoft.com/en-us/library/ms972958.aspx

And then just don't redirect to a login page. Basically you trap the authentication error and keep going.