共用方式為


AuthorizationRuleCollection.Remove(AuthorizationRule) 方法

定義

從集合中移除 AuthorizationRule 物件。

public:
 void Remove(System::Web::Configuration::AuthorizationRule ^ rule);
public void Remove (System.Web.Configuration.AuthorizationRule rule);
member this.Remove : System.Web.Configuration.AuthorizationRule -> unit
Public Sub Remove (rule As AuthorizationRule)

參數

rule
AuthorizationRule

要移除的 AuthorizationRule 物件。

例外狀況

集合中不存在傳遞的 AuthorizationRule 物件,該項目可能已經移除,或者集合是唯讀的。

範例

下列程式碼範例示範如何使用 Remove 方法。 請參閱類別主題中的 AuthorizationSection 程式碼範例,以瞭解如何取得集合。

// Remove the rule from the collection.
authorizationSection.Rules.Remove(authorizationRule);
' Remove the rule from the collection.
authorizationSection.Rules.Remove(authorizationRule)

備註

這個方法會將 remove 專案插入組態檔的適當區段,以供較高層級組態檔中定義的任何專案使用。 如果專案是在目前組態檔的適當區段中定義,則會從組態檔中移除其專案。 要移除的物件必須存在於集合中。

適用於