Aracılığıyla paylaş


HttpListenerResponse.RedirectLocation Özellik

Tanım

Bu yanıttaki HTTP Location üst bilgisinin değerini alır veya ayarlar.

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

Özellik Değeri

String Üst bilgideki istemciye gönderilecek mutlak URL'yi Location içeren.

Özel durumlar

Küme işlemi için belirtilen değer boş bir dizedir ("").

Bu nesne kapatıldı.

Örnekler

Aşağıdaki kod örneğinde bu özelliğin ayarlanması gösterilmektedir.

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

Açıklamalar

Üst bilgi, Location istemcinin istenen kaynağı bulmak için yönlendirildiği URL'yi belirtir.

Not

Bu özelliğin ayarlanması özelliği otomatik olarak ayarlamaz StatusCode .

Şunlara uygulanır

Ayrıca bkz.