Silverlight: HTTP Request Headers

Overview

Silverlight limits the HTTP request headers that can sent with the HttpWebRequest and WebClient objects when making HTTP requests with these classes. The following tables list the headers that are automatically set and also list which headers are not allowed.

Automatic Headers

The following headers are either set by properties, methods or by the system automatically.

Header Description
Accept Set by the browser.
Connection Set by the browser.
Content-Length Set by the browser.
Content-Type Set by the ContentType property. This header cannot be set for a GET method.
Expect Set by the browser.
If-Modified-Since Set by the browser.
Referer Set by the browser.
Transfer-Encoding Set by the browser.
User-Agent Set by the browser.

Restricted Headers

The following lists the most common headers that are restricted. These headers are often set automatically by the browser. Additional headers may also be restricted.

  • Accept
  • Accept-Charset
  • Accept-Encoding
  • Accept-Language
  • Accept-Ranges
  • Age
  • Allow
  • Allowed
  • Authorization
  • Connect
  • Connection
  • Content-Length
  • Content-Location
  • Content-Range
  • Content-Transfer-Encoding
  • Content-Type
  • Cookie
  • Date
  • Delete
  • ETag
  • Expect
  • Get
  • Head
  • Host
  • Keep-Alive
  • Last-Modified
  • Location
  • Max-Forwards
  • Options
  • Post
  • Proxy-Authenticate
  • Proxy-Authorization
  • Proxy-Connection
  • Public
  • Put
  • Range
  • Referer
  • Request-Range
  • Retry-After
  • Server
  • TE
  • Trace
  • Trailer
  • Transfer-Encoding
  • Upgrade
  • Uri
  • User-Agent
  • Vary
  • Via
  • Warning
  • WWW-Authenticate
  • X-Flash-Version

HTTP GET method

The following headers are additionally restricted when using the GET method.

  • Content-Encoding
  • Content-Language
  • Content-Location
  • Content-MD5
  • Content-Range
  • Content-Type
  • Expires
  • Last-Modified

HTTP POST method

The following headers are additionally restricted when using the POST method.

  • Content-Location
  • Content-Range
  • Last-Modified

Further Reading

Related information on the web is listed below.