Using IIS Authentication With ASP.NET Impersonation
In this scenario, you are setting up an application on an intranet Web site for posting employee information. However, some of the information is for managers only. The manager information can be posted to a subdirectory of the general employee information, so that access to it can be limited. The scenario also assumes that:
- You are using a Microsoft Windows NT or Microsoft Windows 2000 server.
- The hard disk is formatted for NTFS.
- Microsoft Internet Information Services (IIS) 6.0 is the Web server.
- All employees needing access are using Windows platforms.
You, as administrator:
Create the files and directories shown in the following illustration.
Files and directories
Create a Windows group called Managers that contains all users who should have access to the ManagerInfo.aspx file.
Set up Windows authentication using the IIS administration tool.
Set the impersonate attribute in the <identity> element in the ASP.NET configuration file to true.
Set the NTFS access control list (ACL) for the ManagerInformation directory to allow access to only those identities that are in the Windows Manager group. Note that the local system still needs access as well so that the ASP.NET process itself can read the files. Settings in this directory typically resemble the following:
- Remove access from the Everyone group, if it has access.
- Deny anonymous users.
- Add accounts that are to have access privileges.
- Give the system account access.
This provides the necessary security without the necessity of writing any code.
See Also
ASP.NET Web Application Security | Designing Secure ASP.NET Applications