CustomErrorCollection.Set(CustomError) Yöntem

Tanım

Belirtilen CustomError değerini koleksiyona ekler.

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)

Parametreler

customError
CustomError

CustomError koleksiyonuna eklenecek.

Örnekler

Aşağıdaki kod örneği, belirtilen CustomError nesnenin nasıl ayarlandığını gösterir. Koleksiyonu nasıl edineceğinizi öğrenmek için sınıf konusunun kod örneğine CustomErrorCollection bakı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

Açıklamalar

Bu belirtilen hata geçerli yapılandırma hatası öğesinin yerini alır.

Şunlara uygulanır