Språk

HttpModuleActionCollection.Remove Metod

Definition

Tar bort en HttpModuleAction modul från samlingen.

Överlagringar

Name Description
Remove(String)

Tar bort ett HttpModuleAction objekt från samlingen.

Remove(HttpModuleAction)

Tar bort ett HttpModuleAction objekt från samlingen.

Kommentarer

Om du vill ta bort en modul från samlingen kan du använda någon av de överlagrade metoderna.

Remove(String)

Tar bort ett HttpModuleAction objekt från samlingen.

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

Parametrar

name
String

Nyckeln som identifierar objektet HttpModuleAction som ska tas bort från samlingen.

Undantag

Det finns inget HttpModuleAction objekt med den angivna nyckeln i samlingen, elementet har redan tagits bort eller samlingen är skrivskyddad.

Exempel

I följande exempel visas hur du tar bort en HttpModuleAction modul från samlingen.


// 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

Kommentarer

Den här metoden infogar ett <remove> element i lämplig del av konfigurationsfilen för alla element som definierats i en konfigurationsfil på högre nivå. Om elementet definieras i lämpligt avsnitt i den aktuella konfigurationsfilen tas dess post bort från konfigurationsfilen. Det objekt som ska tas bort måste finnas i samlingen.

Gäller för

Remove(HttpModuleAction)

Tar bort ett HttpModuleAction objekt från samlingen.

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)

Parametrar

action
HttpModuleAction

Modulen HttpModuleAction som du vill ta bort.

Undantag

Det skickade HttpModuleAction objektet finns inte i samlingen, elementet har redan tagits bort eller samlingen är skrivskyddad.

Exempel

I följande exempel visas hur du tar bort en HttpModuleAction modul från samlingen.

// 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

Kommentarer

Den här metoden infogar ett <remove> element i lämplig del av konfigurationsfilen för alla element som definierats i en konfigurationsfil på högre nivå. Om elementet definieras i lämpligt avsnitt i den aktuella konfigurationsfilen tas dess post bort från konfigurationsfilen. Det objekt som ska tas bort måste finnas i samlingen.

Gäller för