HttpListenerResponse.RedirectLocation プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
この応答の Location
HTTP ヘッダーの値を取得または設定します。
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。
例外
設定操作として指定した値が空の文字列 ("") です。
オブジェクトが閉じています。
例
次のコード例では、このプロパティの設定を示します。
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 にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET