Export (0) Print
Expand All

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)

public:
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

ArgumentException

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

ObjectDisposedException

This object is closed.

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

NoteNote

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 == @"http://www.contoso.com/index.html")
    {
        response.RedirectLocation = @"http://www.contoso.com/indexServer/index.html";
    }
}

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

ADD
Show:
© 2014 Microsoft