HttpResponse.StatusCode 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
클라이언트에 반환된 출력의 HTTP 상태 코드를 가져오거나 설정합니다.
public:
property int StatusCode { int get(); void set(int value); };
public int StatusCode { get; set; }
member this.StatusCode : int with get, set
Public Property StatusCode As Integer
속성 값
클라이언트에 반환된 HTTP 출력의 상태를 나타내는 정수입니다. 기본값은 200(OK)입니다. 유효한 상태 코드 목록은 HTTP 상태 코드를 참조하세요.
예외
StatusCode 는 HTTP 헤더를 보낸 후에 설정됩니다.
예제
다음 예제에서는 출력 스트림의 상태 코드를 확인합니다. 상태 코드가 200과 같지 않으면 추가 코드가 실행됩니다.
protected void Page_Load(object sender, EventArgs e)
{
// Show success or failure of page load.
if (Response.StatusCode != 200)
{
Response.Write("There was a problem accessing the web resource" +
"<br />" + Response.StatusDescription);
}
}
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
' Show success or failure of page load.
If Response.StatusCode <> 200 Then
Response.Write("There was a problem accessing the web resource." & _
"<br />" & Response.StatusDescription)
End If
End Sub