CustomErrorCollection.Remove(String) 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.
CustomError Menghapus objek dari koleksi.
public:
void Remove(System::String ^ statusCode);
public void Remove(string statusCode);
member this.Remove : string -> unit
Public Sub Remove (statusCode As String)
Parameter
- statusCode
- String
Kode status HTTP yang terkait dengan kesalahan kustom.
Contoh
Contoh kode berikut menunjukkan cara menghapus CustomError objek dengan kode status yang ditentukan. Lihat contoh kode dalam CustomErrorCollection topik kelas untuk mempelajari cara mendapatkan koleksi.
// Using the Remove method.
if (!customErrorsSection.SectionInformation.IsLocked)
{
// Remove the error with statuscode 404.
customErrorsCollection.Remove("404");
configuration.Save();
}
' Using the Remove method.
If Not customErrorsSection.SectionInformation.IsLocked Then
' Remove the error with statuscode 404.
customErrorsCollection.Remove("404")
configuration.Save()
End If
Keterangan
Metode Remove ini menyisipkan remove elemen ke bagian customErrors file konfigurasi pada tingkat hierarki saat ini. Ini menghapus referensi ke elemen yang add ditentukan dalam file konfigurasi induk pada tingkat yang lebih tinggi dalam hierarki.
Note
Elemen add tidak dihapus dari file konfigurasi induk. Elemen remove ini hanya menonaktifkannya. Namun, metode ini Remove benar-benar menghapusnya pada tingkat hierarki saat ini.