HttpListenerResponse.RedirectLocation Property


Gets or sets the value of the HTTP Location header in this response.

 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

Property Value


A String that contains the absolute URL to be sent to the client in the Location header.


The value specified for a set operation is an empty string ("").

This object is closed.


The following code example demonstrates setting this property.

public static void TemporaryRedirect(HttpListenerRequest request, HttpListenerResponse response)
    if (request.Url.OriginalString == @"")
        response.RedirectLocation = @"";
Public Shared Sub TemporaryRedirect(ByVal request As HttpListenerRequest, ByVal response As HttpListenerResponse)
    If request.Url.OriginalString = "" Then
        response.RedirectLocation = ""
    End If
End Sub


The Location header specifies the URL to which the client is directed to locate a requested resource.


Setting this property does not automatically set the StatusCode property.

Applies to

See also