At work, we integrate our LDAP instance and our LDAP groups into the security of our applications. Organization-wide, if your organizational ID made it into the LDAP instance, you'll have some form of access to the application. We further refine that by specifying groups that have more advanced access. Since logging into your computer logs you into the domain, for local development there is a desire to by-pass re-authenticating in favor of using Windows authentication.
In Visual Studio, this is pretty easy. Make sure the properties window is visible, and then click on the project in the explorer window. The properties window will show you the project properties, which will include both anonymous and windows authentication options.
If you are using IIS Express to serve your web application, this is actually a hook into the IIS Express configuration.
If you are not using Visual Studio, you won't have this handy GUI window, so what do you do?
First, locate the IIS Express
applicationhost.config file. It is usually in your
Documents folder in your user directory. Mine is located at
This file acts as the user-specific global configuration for IIS Express. You'll want to make a couple of changes.
First, locate the authentication section, and make sure that the overrides for anonymous and windows authentication are set to "Allow" in the attributes. This will let you override the authentication in your Web.config file in your application.
<sectionGroup name="authentication"> <section name="anonymousAuthentication" overrideModeDefault="Allow" /> <section name="basicAuthentication" overrideModeDefault="Deny" /> <section name="clientCertificateMappingAuthentication" overrideModeDefault="Deny" /> <section name="digestAuthentication" overrideModeDefault="Deny" /> <section name="iisClientCertificateMappingAuthentication" overrideModeDefault="Deny" /> <section name="windowsAuthentication" overrideModeDefault="Allow" /> </sectionGroup>
Next, find the
system.webServer section where the modules are listed. Again, locate the ones for anonymous and windows authentication, and change the lock value to false:
<add name="AnonymousAuthenticationModule" lockItem="false" /> <add name="WindowsAuthenticationModule" lockItem="false" />
Save this file, and close it. Now, inside of your application, add a security section to the
system.webServer node in the Web.config file in order to override the default security values:
<security> <authentication> <windowsAuthentication enabled="true" /> <anonymousAuthentication enabled="false" /> </authentication> </security>
Now you can override the authentication values for windows and anonymous authentication inside of your Web.config. Assuming your browser allows for that authentication to pass through, you should be able to launch you application without re-authenticating.
(Photo by (Belur Ashok)[https://www.flickr.com/photos/belurashok/35477333454/in/photolist-W41Be1-UqA6dk-7MF6sQ-buCpqH-WBXnh7-hj2Ypv-4g85Lw-247Dbmh-56sJu5-W6chg4-273Vuzu-bAeoTt-aRk71x-de4GAv-c2nQmE-aNQjWR-6BzG3M-bnXH81-baZVmk-DUauNd-aQ8nZH-anJuYY-pbJ3sY-brYMTa-ixpNt8-pdGFC-5eRod-5Tcqbz-VVhnYu-aeDYYo-aEKqoB-d4Vq1m-at3Kmu-JEWSG7-bJQcft-8rp6t4-bUkJEz-bw7pxR-fZovm-6TeQFD-a82NFf-fZmAh-q6UobB-fZkEL-24nR4aE-bASwVz-d4VpTY-bMoWiB-GCmJE-25okmWd])