AuthorizationRuleCollection 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示 对象的集合 AuthorizationRule 。 此类不能被继承。
public ref class AuthorizationRuleCollection sealed : System::Configuration::ConfigurationElementCollection
[System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.AuthorizationRule), AddItemName="allow,deny", CollectionType=System.Configuration.ConfigurationElementCollectionType.BasicMapAlternate)]
public sealed class AuthorizationRuleCollection : System.Configuration.ConfigurationElementCollection
[<System.Configuration.ConfigurationCollection(typeof(System.Web.Configuration.AuthorizationRule), AddItemName="allow,deny", CollectionType=System.Configuration.ConfigurationElementCollectionType.BasicMapAlternate)>]
type AuthorizationRuleCollection = class
inherit ConfigurationElementCollection
Public NotInheritable Class AuthorizationRuleCollection
Inherits ConfigurationElementCollection
- 继承
- 属性
示例
下面的代码示例演示如何从现有 Web 应用程序的配置文件中获取 AuthorizationRuleCollection 对象。 使用此对象访问其成员,如以下主题所示。 配置文件将包含如下所示的设置。
<authorization>
<allow users="userName" roles="admin" verbs="post" />
<deny users="*" verbs="post"/>
</authorization>
// Get the Web application configuration.
System.Configuration.Configuration configuration =
WebConfigurationManager.OpenWebConfiguration(
"/aspnetTest");
' Get the Web application configuration.
Dim configuration As System.Configuration.Configuration = _
WebConfigurationManager.OpenWebConfiguration( _
"/aspnetTest")
// Get the section.
AuthorizationSection authorizationSection =
(AuthorizationSection)configuration.GetSection(
"system.web/authorization");
' Get the section.
Dim authorizationSection _
As AuthorizationSection = _
CType(configuration.GetSection( _
"system.web/authorization"), AuthorizationSection)
// Get the authorization rule collection.
AuthorizationRuleCollection authorizationRuleCollection =
authorizationSection.Rules;
' Get the authorization rule collection.
Dim authorizationRuleCollection _
As AuthorizationRuleCollection = _
authorizationSection.Rules
注解
该 AuthorizationRuleCollection 类型允许访问节集合的 authorization 元素。
构造函数
| 名称 | 说明 |
|---|---|
| AuthorizationRuleCollection() |
初始化 AuthorizationRuleCollection 类的新实例。 |
属性
方法
显式接口实现
| 名称 | 说明 |
|---|---|
| ICollection.CopyTo(Array, Int32) |
将 ConfigurationElementCollection 复制到数组。 (继承自 ConfigurationElementCollection) |
扩展方法
| 名称 | 说明 |
|---|---|
| AsParallel(IEnumerable) |
启用查询的并行化。 |
| AsQueryable(IEnumerable) |
将 IEnumerable 转换为 IQueryable。 |
| Cast<TResult>(IEnumerable) |
将 IEnumerable 的元素强制转换为指定类型。 |
| OfType<TResult>(IEnumerable) |
根据指定类型筛选 IEnumerable 的元素。 |