CustomErrorCollection.Remove(String) Metod

Definition

Tar bort ett CustomError objekt från samlingen.

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

Parametrar

statusCode
String

HTTP-statuskoden som är associerad med det anpassade felet.

Exempel

I följande kodexempel visas hur du CustomError tar bort objektet med den angivna statuskoden. Se kodexemplet i klassavsnittet CustomErrorCollection för att lära dig hur du hämtar samlingen.

// Using the Remove method.
if (!customErrorsSection.SectionInformation.IsLocked)
{
    // Remove the error with statuscode 404.
    customErrorsCollection.Remove("404");
    configuration.Save();
}
' Using the Remove method.
If Not customErrorsSection.SectionInformation.IsLocked Then
   ' Remove the error with statuscode 404.
   customErrorsCollection.Remove("404")
   configuration.Save()
End If

Kommentarer

Metoden Remove infogar ett remove element i customErrors avsnittet i konfigurationsfilen på den aktuella hierarkinivån. Detta tar bort referensen till det add element som definierats i de överordnade konfigurationsfilerna på högre nivåer i hierarkin.

Note

Elementen add tas inte bort från de överordnade konfigurationsfilerna. Elementet remove inaktiverar dem bara. Metoden tar dock Remove faktiskt bort dem på den aktuella hierarkinivån.

Gäller för