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
- 繼承
- 屬性
範例
以下程式碼範例說明如何從現有網頁應用程式的設定檔取得該 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 元素。
建構函式
| 名稱 | Description |
|---|---|
| AuthorizationRuleCollection() |
初始化 AuthorizationRuleCollection 類別的新執行個體。 |
屬性
方法
明確介面實作
| 名稱 | Description |
|---|---|
| ICollection.CopyTo(Array, Int32) |
將 ConfigurationElementCollection 複製到陣列。 (繼承來源 ConfigurationElementCollection) |
擴充方法
| 名稱 | Description |
|---|---|
| AsParallel(IEnumerable) |
啟用查詢的平行處理。 |
| AsQueryable(IEnumerable) |
將 IEnumerable 轉換成 IQueryable。 |
| Cast<TResult>(IEnumerable) |
將 IEnumerable 的項目轉換成指定的型別。 |
| OfType<TResult>(IEnumerable) |
根據指定的型別篩選 IEnumerable 的專案。 |