CustomErrorCollection.Set(CustomError) Methode

Definition

Fügt der Auflistung den angegebenen CustomError Wert hinzu.

public:
 void Set(System::Web::Configuration::CustomError ^ customError);
public void Set(System.Web.Configuration.CustomError customError);
member this.Set : System.Web.Configuration.CustomError -> unit
Public Sub Set (customError As CustomError)

Parameter

customError
CustomError

Das CustomError , das der Auflistung hinzugefügt werden soll.

Beispiele

Das folgende Codebeispiel zeigt, wie das angegebene CustomError Objekt festgelegt wird. Weitere Informationen zum Abrufen der Auflistung finden Sie im Codebeispiel im CustomErrorCollection Klassenthema.

// Using the Set method.
CustomError newCustomError =
new CustomError(404, "customerror404.htm");

// Update the configuration file.
if (!customErrorsSection.SectionInformation.IsLocked)
{
    // Add the new custom error to the collection.
    customErrorsCollection.Set(newCustomError);
    configuration.Save();
}
' Using the Set method.
  Dim newCustomError _
  As New CustomError(404, "customerror404.htm")

' Update the configuration file.
If Not customErrorsSection.SectionInformation.IsLocked Then
   ' Add the new custom error to the collection.
   customErrorsCollection.Set(newCustomError)
   configuration.Save()
End If

Hinweise

Dieser angegebene Fehler ersetzt das aktuelle Konfigurationsfehlerelement.

Gilt für: