Authorization determines whether an identity should be granted the requested type of access to a given resource.
ASP.NET implements authorization through authorization providers, the modules that contain the code to authorize access to a given resource. ASP.NET includes the following authorization modules.
| ASP.NET Authentication Provider | Description |
|---|---|
| File authorization | File authorization is performed by the FileAuthorizationModule, and is active when the application is configured to use Windows authentication. It checks the access control list ( ACL ) of the file to determine whether a user should have access to the file. ACL permissions are verified for the Windows identity or, if impersonation is enabled, for the Windows identity of the ASP.NET process. For more information, see ASP.NET Impersonation. |
| URL authorization | URL authorization is performed by the URLAuthorizationModule, which maps users and roles to URLs in ASP.NET applications. This module can be used to selectively allow or deny access to arbitrary parts of an application ( typically directories ) for specific users or roles. |
Configuring authorization using the <authorization> section
To enable URL authorization for a given directory ( including the application root directory ), you need to set up a configuration file that contains an authorization section for that directory. The general syntax for the authorization section is as follows:
<authorization>
< [ allow | deny ] [ users ] [ roles ] [ verbs ] />
</authorization>
The allow or deny element is required, and either the users or the roles attribute must be specified. Both can be included, but both are not required. The verbs attribute is optional.
The allow and deny elements grant and revoke access, respectively. Each element supports three attributes, which are defined in the following table.
| Attribute | Description |
|---|---|
| roles | Identifies a targeted role for this element. For more information, see ASP.NET Roles. |
| users | Identifies the targeted identity names ( user accounts ) for this element. For more information, see ASP.NET Membership. |
| verbs | Defines the HTTP verbs to which the action applies, such as GET, HEAD, or POST. The default is "*", which specifies all verbs. |

Join the conversation! Your thoughts help the community grow.