I've created a MVC Web Application using Visual Studio 2015. My goal is to change the authentication mode from none to Windows Authentication as I need so I can use the @User.Identity.Name method to identify the user. A short summary of what I've tried so far:
Project Properties
- set Anonymous Authentication: disabled
- set Windows Authentication: enabled
Web.config
- adding maxUrlLength="65536" attribute to the httpRuntime tag
- adding maxQueryStringLength="10240" attribute to the httpRuntime tag
- adding
<authentication mode="Windows"/>within the<system.web>tag adding the system.webServer tag (this ends up in a ERR_TOO_MANY_REDIRECTS whenever I add it):
<system.webServer> <security> <requestFiltering> <requestLimits maxUrl="10999" maxQueryString="2097151" /> </requestFiltering> </security> </system.webServer>
Windows
- In Control Panel open "Programs and Features".
- Select "Turn Windows features on or off".
- Navigate to Internet Information Services > World Wide Web Services > Security and make sure the Windows authentication node is checked.
IIS Express
I tried creating a new project from scratch and neatly selecting Windows Authentication during the setup of the project. This works fine, so I believe my IISExpress settings are 100% correct. I even checked the applicationhost.config file and it doesn't have an entry for my specific project. Again, it works just fine if I select the correct authentication when creating a new project.
None of the above seems to work and all end up with an IIS error when I try to run the Visual Studio project:
HTTP Error 404.15 - Not Found
The request filtering module is configured to deny a request where the query string is too long.
This is what the URL looks like in the IIS Error Page:
As you can tell I get an infinite redirect loop, and this is probably the reason why I'm unable to get this working. I do however have no idea what is causing it. Any help is greatly appreciated.