Implementing Windows authentication in ASP.NET on IIS 7
For implementing windows authentication in IIS 7 (On Windows Vista),
you need to check whether the Windows authentication installed or not. You can do this either using Programs and Features > Turn Windows features On or Off. And select the Checkbox windows authentication from Security.
After installing the Windows Authentication in your system, update your IIS in web application settings. Select Authentication, and enable the Windows Authentication. And disable the Anonymous Authentication.
Now in the Web.config file, set the Authentication mode to Windows.
<authentication mode="Windows" />
Also set the authorization rules, like which all users / roles need access etc.
<authorization> <allow users="DOMAIN\USER, DOMAIN\USER2" /> <deny users="*"/> </authorization>
Now modify the Default.aspx page so that it can display the current username.
<body>
<form id="form1" runat="server">
<div>
< %= User.Identity.Name %>
</div>
</form>
</body>
Now run the application, it will display the Windows Authentication dialog, if your username not in the list. If you cancel the login dialog it will display a Access Denied page. If you give the correct username and password, it will display the Username.
You can get more information from How to implement Windows authentication and authorization in ASP.NET


