HttpModuleActionCollection.Remove 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
從集合中移除一個 HttpModuleAction 模組。
多載
| 名稱 | Description |
|---|---|
| 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> 設定檔中對應高階設定檔中定義的元素的適當區段。 如果該元素在目前設定檔的適當區段中被定義,該元素的條目會從設定檔中移除。 要移除的物件必須存在於集合中。