Windows authentication and authorization in asp.net:-
We have discussed the basics of windows authentication. In this article, we will continue to discuss about windows authentication.

? and * have special meaning when used in the authorization element in web.config
? (Question Mark) - Indicates anonymous users
* (Star) - Indicates all users  

Allowing or denying access to specific users:
When you run the application, with the following authorization list in web.config, only users "santosh" and "gagan" are allowed to access the application. If you are logged, into the computer, as any other user, the application prompts the user to provide user name and password. All the other users are denied access to the application.
<authorization>
  <allow users="SANTOSH-PC\santosh, SANTOSH-PC\gagan"/>
  <deny users="*"/>
</authorization>  

Using windows roles to control access:
Windows operating system has several roles, like Administrators, Guests, Users etc. It is also possible to control access to resources using these roles in the web.config file. The following authorization list, only allows users belonging to Administrators role. All the other users are denied access.
<authorization>
  <allow roles="Administrators"/>
  <deny users="*"/>
</authorization>

How to programmatically check if the user belongs to a specific role?
if (User.IsInRole("Administrators"))
{
    // Do Admin Stuff
}
else
{
    // Do Non-Admin stuff
}