CustomErrorCollection.Set(CustomError) Methode

Definitie

Voegt de opgegeven CustomError waarde toe aan de verzameling.

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)

Parameters

customError
CustomError

De CustomError toe te voegen aan de verzameling.

Voorbeelden

In het volgende codevoorbeeld ziet u hoe u het opgegeven CustomError object instelt. Raadpleeg het codevoorbeeld in het CustomErrorCollection klasseonderwerp voor meer informatie over het ophalen van de verzameling.

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

Opmerkingen

Deze opgegeven fout vervangt het huidige configuratiefoutelement.

Van toepassing op