CustomErrorCollection.Set(CustomError) Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Menambahkan yang ditentukan CustomError ke koleksi.
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)
Parameter
- customError
- CustomError
untuk CustomError ditambahkan ke koleksi.
Contoh
Contoh kode berikut menunjukkan cara mengatur objek yang ditentukan CustomError . Lihat contoh kode dalam CustomErrorCollection topik kelas untuk mempelajari cara mendapatkan koleksi.
// 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
Keterangan
Kesalahan yang ditentukan ini menggantikan elemen kesalahan konfigurasi saat ini.