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> 元素插入配置文件的相应部分,以用于更高级别配置文件中定义的任何元素。 如果在当前配置文件的相应部分中定义了 元素,则会从配置文件中删除其条目。 要删除的对象必须存在于集合中。

适用于