CustomErrorCollection.Set(CustomError) Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Lägger till den angivna CustomError i samlingen.
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)
Parametrar
- customError
- CustomError
Att CustomError lägga till i samlingen.
Exempel
I följande kodexempel visas hur du anger det angivna CustomError objektet. Se kodexemplet i klassavsnittet CustomErrorCollection för att lära dig hur du hämtar samlingen.
// 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
Kommentarer
Det angivna felet ersätter det aktuella konfigurationsfelelementet.