CustomError.StatusCode Properti
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.
Mendapatkan atau mengatur kode status kesalahan HTTP.
public:
property int StatusCode { int get(); void set(int value); };
[System.Configuration.ConfigurationProperty("statusCode", IsKey=true, IsRequired=true)]
[System.Configuration.IntegerValidator(MaxValue=999, MinValue=100)]
public int StatusCode { get; set; }
[<System.Configuration.ConfigurationProperty("statusCode", IsKey=true, IsRequired=true)>]
[<System.Configuration.IntegerValidator(MaxValue=999, MinValue=100)>]
member this.StatusCode : int with get, set
Public Property StatusCode As Integer
Nilai Properti
Kode status kesalahan HTTP yang menyebabkan pengalihan ke halaman kesalahan kustom.
- Atribut
Contoh
Contoh kode berikut menunjukkan cara menggunakan kode status. Lihat contoh kode dalam CustomError topik kelas untuk mempelajari cara mendapatkan koleksi.
// Get second error StatusCode.
CustomError currentError1 =
customErrorsCollection[1];
int currentStatusCode =
currentError1.StatusCode;
// Set the second error StatusCode.
currentError1.StatusCode = 404;
' Get second error StatusCode.
Dim currentError1 As CustomError = _
customErrorsCollection(1)
Dim currentStatusCode As Integer = _
currentError1.StatusCode
' Set the second error StatusCode.
currentError1.StatusCode = 404
Keterangan
Kode status HTTP digunakan oleh infrastruktur ASP.NET untuk mengalihkan aplikasi ke halaman kesalahan ketika terjadi kesalahan tertentu.
Note
Kesalahan kustom dikeluarkan hanya jika disebabkan oleh entitas yang ditangani oleh ASP.NET; jika tidak, kesalahan standar dikeluarkan.