| |||||||||||||||||
<authorization> allow ElementASP.NET Syntax ASP.NET Configuration Sections Adds an authorization rule that allows access to a resource to the mapping of authorization rules. <allow users = "comma-separated list of users" roles = "comma-separated list of roles" verbs = "comma-separated list of verbs" /> Attributes and ElementsThe following sections describe attributes, child elements, and parent elements. Attributes
Child ElementsNone. Parent Elements
RemarksThe allow element adds an authorization rule that allows access to a resource to the mapping of authorization rules that are stored in the authorization element. The authorization element configures the authorization for a Web application, by controlling client access to URL resources. For the required attributes, you can use either the users or roles attribute or both. At run time, the authorization module iterates through the allow and deny elements, starting at the most local configuration file, until the authorization module finds the first access rule that fits a particular user account. Then, the authorization module grants or denies access to a URL resource depending on whether the first access rule found is an allow or a deny rule. The default authorization rule is <allow users = "*" />. Thus, by default, access is allowed unless configured otherwise. In order to facilitate deployment, the period ( <allow roles = ".\roleName" /> <allow users = ".\userName" /> At run time the period-backslash sequences are substituted with Because the authorization element does not represent a collection, there are no clear or remove child elements. To programmatically clear the mappings of authorization rules, use the Clear or Remove method that is defined by the AuthorizationRuleCollection Class. Default ConfigurationThe following default authorization element is configured in the root Web.config file in the .NET Framework version 2.0 and configured in the Machine.config file in the .NET Framework versions 1.1 and 1.0. <authorization> <allow users = "*" /> </authorization> ExampleThe following code example demonstrates how to deny access to all user accounts and allows access to all members of the role <configuration>
<system.web>
<authorization>
<allow roles = "admins" />
<deny users = "*" />
</authorization>
</system.web>
</configuration>
See AlsoASP.NET Configuration <authorization> Section <authorization> deny Element |
| ||||||||||||||||
Check out related books at Amazon
© 2000-2008 Rey Nuñez All rights reserved.
If you have any question, comment or suggestion
about this site, please send us a note