Share via


CustomErrorCollection.Set(CustomError) Método

Definición

Agrega el CustomError especificado a la colección.

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)

Parámetros

customError
CustomError

CustomError que se agrega a la colección.

Ejemplos

En el ejemplo de código siguiente se muestra cómo establecer el objeto especificado CustomError . Consulte el ejemplo de código del tema de clase CustomErrorCollection para obtener información sobre cómo obtener la colección.

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

Comentarios

Este error especificado reemplaza el elemento de error de configuración actual.

Se aplica a