Share via


HttpModuleActionCollection.Remove 方法

定義

移除集合中的 HttpModuleAction 模組。

多載

Remove(String)

從集合中移除 HttpModuleAction 物件。

Remove(HttpModuleAction)

從集合中移除 HttpModuleAction 物件。

備註

若要從其集合中移除模組,您可以使用其中一個列出的多載方法。

Remove(String)

從集合中移除 HttpModuleAction 物件。

public:
 void Remove(System::String ^ name);
public void Remove (string name);
member this.Remove : string -> unit
Public Sub Remove (name As String)

參數

name
String

索引鍵,識別要從集合移除的 HttpModuleAction 物件。

例外狀況

集合中沒有具備指定索引鍵的 HttpModuleAction 物件,該項目可能已經移除,或者集合是唯讀的。

範例

下列範例示範如何從集合中移除 HttpModuleAction 模組。


// Remove the module from the collection.
if (!httpModulesSection.SectionInformation.IsLocked)
{
    modulesCollection.Remove("TimerModule");
    configuration.Save();
}
' Remove the module from the collection.
If Not httpModulesSection.SectionInformation.IsLocked Then
    modulesCollection.Remove("MyModule2Name")
    configuration.Save()
End If

備註

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

適用於

Remove(HttpModuleAction)

從集合中移除 HttpModuleAction 物件。

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

參數

action
HttpModuleAction

要移除的 HttpModuleAction 模組。

例外狀況

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

範例

下列範例示範如何從集合中移除 HttpModuleAction 模組。

// Set the module object.
HttpModuleAction ModuleAction2 = 
    new HttpModuleAction("MyModule2Name",
    "MyModule2Type");

// Remove the module from the collection.
if (!httpModulesSection.SectionInformation.IsLocked)
{
    modulesCollection.Remove(ModuleAction2);
    configuration.Save();
}
' Set the module object.
Dim ModuleAction2 As New HttpModuleAction( _
"MyModule2Name", "MyModule2Type")
' Remove the module from the collection.
If Not httpModulesSection.SectionInformation.IsLocked Then
    modulesCollection.Remove(ModuleAction2)
    configuration.Save()
End If

備註

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

適用於