I solved this by changing the background of the problem.
Now the entire server is accessible anonymously, but the paths that require Windows authentication have been specified on their own.
An example of what controllers that need protection look like:
<location path="#####.ashx"> <system.webServer> <security> <authentication> <anonymousAuthentication enabled="false"/> <windowsAuthentication enabled="true"/> </authentication> <authorization> <remove users="?" roles="" verbs="" /> <add accessType="Deny" users="?" /> </authorization> </security> </system.webServer> < /location>
And the general parameter for the server:
<system.webServer> <security> <authentication> <anonymousAuthentication enabled="true"/> <windowsAuthentication enabled="true"/> </authentication> <authorization> <add accessType="Allow" users="?" /> </authorization> <requestFiltering> <requestLimits maxQueryString="3072" /> </requestFiltering> </security> </system.webServer>
This may not be a viable solution for everyone, but it worked for me ... :)
As a side note: while working with this, I also fought IIS Express and generally could set Windows authentication in web.config. This post really helped me -> IIS Express Windows Authentication
Bjørn
source share