HttpModuleActionCollection.Remove 方法
定义
从集合中移除 HttpModuleAction 模块。Removes an HttpModuleAction module from the collection.
重载
| Remove(String) |
从集合中删除 HttpModuleAction 对象。Removes an HttpModuleAction object from the collection. |
| Remove(HttpModuleAction) |
从集合中删除 HttpModuleAction 对象。Removes an HttpModuleAction object from the collection. |
注解
若要从集合中删除模块,可以使用列出的重载方法之一。To remove a module from its collection, you can use one of listed overloaded methods.
Remove(String)
从集合中删除 HttpModuleAction 对象。Removes an HttpModuleAction object from the collection.
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 对象的键。The key that identifies the HttpModuleAction object to remove from the collection.
例外
集合中不存在任何具有指定键的 HttpModuleAction 对象,该元素已移除或该集合为只读。There is no HttpModuleAction object with the specified key in the collection, the element has already been removed, or the collection is read-only.
示例
下面的示例演示如何 HttpModuleAction 从集合中移除模块。The following example shows how to remove an HttpModuleAction module from the collection.
// 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> 元素插入到配置文件的相应部分,该部分是在更高级配置文件中定义的任何元素。This method inserts a <remove> element into the appropriate section of the configuration file for any element defined in a higher-level configuration file. 如果在当前配置文件的相应部分中定义了元素,则会从配置文件中删除其条目。If the element is defined in the appropriate section of the current configuration file, its entry is removed from the configuration file. 集合中必须存在要删除的对象。The object to remove must exist in the collection.
适用于
Remove(HttpModuleAction)
从集合中删除 HttpModuleAction 对象。Removes an HttpModuleAction object from the collection.
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 模块。The HttpModuleAction module to remove.
例外
集合中不存在传递的 HttpModuleAction 对象,元素已移除或集合为只读。The passed HttpModuleAction object does not exist in the collection, the element has already been removed, or the collection is read-only.
示例
下面的示例演示如何 HttpModuleAction 从集合中移除模块。The following example shows how to remove an HttpModuleAction module from the collection.
// 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> 元素插入到配置文件的相应部分,该部分是在更高级配置文件中定义的任何元素。This method inserts a <remove> element into the appropriate section of the configuration file for any element defined in a higher-level configuration file. 如果在当前配置文件的相应部分中定义了元素,则会从配置文件中删除其条目。If the element is defined in the appropriate section of the current configuration file, its entry is removed from the configuration file. 集合中必须存在要删除的对象。The object to remove must exist in the collection.