Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

HttpRequestHeaderCollection.Referer | referer property

Applies to Windows and Windows Phone

Gets or sets the Uri that represents the value of a Referer HTTP header on an HTTP request.

Syntax


var referer = httpRequestHeaderCollection.referer;
httpRequestHeaderCollection.referer = referer;

Property value

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

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

Remarks

The following sample code shows a method to set the Referer header on an HttpRequestMessage object using the Referer property on the HttpRequestHeaderCollection object.


    public void DemonstrateHeaderRequestReferer() {
        var request = new HttpRequestMessage();

        // This is not typically set with a string.

        // Set the header with a strong type.
        // Uri is either in the Windows.Foundation namespace (JavaScript and C++)
        // or in the System.Net namespace (C#).
        var value = new Uri("http://example.com/");
        request.Headers.Referer = value;

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

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


Requirements

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

HttpRequestHeaderCollection
HttpRequestMessage
HttpRequestMessage.Headers
Uri

 

 

Show:
© 2014 Microsoft