Skip to main content
HttpClient.DefaultRequestHeaders | defaultRequestHeaders property

Gets a collection of headers that should be sent with each request.


var defaultRequestHeaders = httpClient.defaultRequestHeaders;

public HttpRequestHeaderCollection DefaultRequestHeaders { get; }

Public ReadOnly Property DefaultRequestHeaders As HttpRequestHeaderCollection

property HttpRequestHeaderCollection^ DefaultRequestHeaders { 
   HttpRequestHeaderCollection^ get();

Property value

Type: HttpRequestHeaderCollection

The headers that should be sent with each request.


The DefaultRequestHeaders property returns an HttpRequestHeaderCollection object that can be used to get or set the specific headers on the HttpClient instance. HTTP headers set on this property will be sent on all request messages sent on this HttpClient instance and don't need to be set on each HttpRequestMessage instance.

The Headers property on the HttpRequestMessage object returns an HttpRequestHeaderCollection object that can be used to get or set the specific headers on a specific HTTP request.

The DefaultRequestHeaders property represents the headers that an app developer can set, not all of the headers that may eventually be sent with the request. The HttpBaseProtocolFilter will add some additional headers.


In versions before Windows 10, setting certain headers to NULL caused an empty header value to be set, which caused an unexpected failure in subsequent calls to GetAsync. Starting in Windows 10, setting any of the following headers to NULL causes them to be removed from the request entirely, so that the remaining headers are valid.

  • Authorization
  • Date
  • From
  • Host
  • If-Modified-Since
  • If-Unmodified-Since
  • Max-Forwards
  • Proxy-Authorization
  • Referer

If you are writing for versions before Windows 10, do not set these header values to NULL.


Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0


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



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]


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



See also