HttpListenerResponse.RedirectLocation 속성

정의

이 응답의 HTTP Location 헤더 값을 가져오거나 설정합니다.

public:
 property System::String ^ RedirectLocation { System::String ^ get(); void set(System::String ^ value); };
public string? RedirectLocation { get; set; }
public string RedirectLocation { get; set; }
member this.RedirectLocation : string with get, set
Public Property RedirectLocation As String

속성 값

Location 헤더에 있는 클라이언트에 보낼 절대 URL이 들어 있는 String입니다.

예외

set 작업에 지정된 값이 빈 문자열("")인 경우

이 개체가 닫혀 있는 경우

예제

다음 코드 예제에서는이 속성을 설정 하는 방법을 보여 줍니다.

public static void TemporaryRedirect(HttpListenerRequest request, HttpListenerResponse response)
{
    if (request.Url.OriginalString == @"http://www.contoso.com/index.html")
    {
        response.RedirectLocation = @"http://www.contoso.com/indexServer/index.html";
    }
}
Public Shared Sub TemporaryRedirect(ByVal request As HttpListenerRequest, ByVal response As HttpListenerResponse)
    If request.Url.OriginalString = "http://www.contoso.com/index.html" Then
        response.RedirectLocation = "http://www.contoso.com/indexServer/index.html"
    End If
End Sub

설명

헤더는 Location 클라이언트가 요청된 리소스를 찾도록 지시하는 URL을 지정합니다.

참고

이 속성을 설정해도 속성이 StatusCode 자동으로 설정되지 않습니다.

적용 대상

추가 정보