HttpListenerResponse.RedirectLocation 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이 응답의 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 자동으로 설정되지 않습니다.
적용 대상
추가 정보
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET