Windows Dev Center

HttpResponseHeaderCollection.Location | location property

Gets or sets the Uri that represents the value or a Location HTTP header on an HTTP response.

Syntax


var location = httpResponseHeaderCollection.location;
httpResponseHeaderCollection.location = location;

Property value

Type: Windows.Foundation.Uri [JavaScript] | System.Uri [.NET] | Windows::Foundation::Uri [C++]

The object that represents the value of a Location HTTP header on an HTTP response. A null value means that the header is absent.

Remarks

The following sample code shows a method to set the Location header on an HttpResponseMessage object using the Location property on the HttpResponseHeaderCollection object.


    public void DemonstrateHeaderResponseLocation() {
        var response = new HttpResponseMessage();

        // Set the header with a strong type.
        response.Headers.Location = new Uri("http://example.com/");

        // Get the strong type out
        System.Diagnostics.Debug.WriteLine("Location absolute uri: {0}", response.Headers.Location.AbsoluteUri);

        // The ToString() is useful for diagnostics, too.
        System.Diagnostics.Debug.WriteLine("The Location ToString() results: {0}", response.Headers.Location.ToString());
    }


Requirements (Windows 10 device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Web.Http.Headers
Windows::Web::Http::Headers [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Web.Http.Headers
Windows::Web::Http::Headers [C++]

Metadata

Windows.winmd

See also

HttpResponseHeaderCollection
HttpResponseMessage
HttpResponseMessage.Headers
Uri

 

 

Show:
© 2015 Microsoft