HttpResponseHeaderCollection.Location Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public:
property Uri ^ Location { Uri ^ get(); void set(Uri ^ value); };
Uri Location();
void Location(Uri value);
public System.Uri Location { get; set; }
var uri = httpResponseHeaderCollection.location;
httpResponseHeaderCollection.location = uri;
Public Property Location As Uri
Property Value
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());
}