CustomErrorCollection.Set(CustomError) Metodo

Definizione

Aggiunge l'oggetto CustomError specificato alla raccolta.

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)

Parametri

customError
CustomError

Oggetto CustomError da aggiungere alla raccolta.

Esempio

Nell'esempio di codice seguente viene illustrato come impostare l'oggetto specificato CustomError . Fare riferimento all'esempio di codice nell'argomento della CustomErrorCollection classe per informazioni su come ottenere la raccolta.

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

Commenti

Questo errore specificato sostituisce l'elemento di errore di configurazione corrente.

Si applica a