RedirectLocation Property

HttpListenerResponse.RedirectLocation Property

Note: This property is new in the .NET Framework version 2.0.

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

Namespace: System.Net
Assembly: System (in system.dll)

property String^ RedirectLocation {
	String^ get ();
	void set (String^ value);
/** @property */
public String get_RedirectLocation ()

/** @property */
public void set_RedirectLocation (String value)

public function get RedirectLocation () : String

public function set RedirectLocation (value : String)

Property Value

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

Exception typeCondition


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


This object is closed.

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.

The following code example demonstrates setting this property.

public static void TemporaryRedirect(HttpListenerRequest request, HttpListenerResponse response)
    if (request.Url.OriginalString == @"")
        response.RedirectLocation = @"";

Windows 98, Windows Server 2003, Windows XP Media Center Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

© 2015 Microsoft