CustomError.StatusCode Özellik

Tanım

HTTP hata durum kodunu alır veya ayarlar.

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

Özellik Değeri

Özel hata sayfasına yeniden yönlendirmeye neden olan HTTP hata durum kodu.

Öznitelikler

Örnekler

Aşağıdaki kod örneğinde durum kodunun nasıl kullanılacağı gösterilmektedir. Koleksiyonu nasıl edineceğinizi öğrenmek için sınıf konusunun kod örneğine CustomError bakın.

// 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

Açıklamalar

HTTP durum kodu, belirli bir hata oluştuğunda uygulamayı hata sayfasına yönlendirmek için ASP.NET altyapısı tarafından kullanılır.

Note

Özel hata yalnızca ASP.NET tarafından işlenen bir varlık nedeniyle oluşursa verilir; aksi takdirde standart bir hata verilir.

Şunlara uygulanır