| Example 72 SimpleAUthentication/Sales/Default.aspx |
<html>
<head><title>Default.aspx</title></head>
<body>
<h1>Welcome <%=User.Identity.Name %> to Sales!</h1>
</body>
</html>
|
| |
|
| Example 73 SimpleAUthentication/Managers/Web.Config |
<configuration>
<system.web>
<authorization>
<allow users="YourDomain\Sam" />
<deny users="*" />
</authorization>
</system.web>
</configuration>
|
| |
| Example 74 SimpleAUthentication/Managers/Default.aspx |
<html>
<head><title>Default.aspx</title></head>
<body>
<h1>Welcome <%=User.Identity.Name %> to Managers!</h1>
</body>
</html>
|
| |
Imagine that You have two user accounts, one named Sam and one named George. The Sam user account is a member of the Managers group, and the George user account is a member of the Sales group.
| Note |
| As long as the Everyone group has access to the files in a Web application, you do not need to explicitly add either the Sam or George user accounts to the file permissions for the application. |
By default, both Sam and George have access to every page in the application. To prevent George from accessing any file in the Managers folder, the web.Config file in example 73 has to be added to the Managers folder as shown above.
The web.config file in example 71 explicitly allows Sam to access files in the current directory and explicitly denies everyone else access. Because George is not granted permissions to access files in the directory, he can not access any files. To enable access to both Sam and George to all the files in the Sales directory, the Web.Config file can be used as shown in example 71. The Web.Config file in example 71 explicitly provides both Sam and George access to the files in the current directory.
|