CustomErrorCollection.Set(CustomError) Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
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.