Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The headers collection "protects" some of the possible headers as described on the msdn page here: <a href="http://msdn.microsoft.com/en-us/library/system.net.webclient.headers.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.net.webclient.headers.aspx</a></p> <p>That page seems to give all the answer you need but to quote the important part:</p> <blockquote> <p>Some common headers are considered restricted and are protected by the system and cannot be set or changed in a WebHeaderCollection object. Any attempt to set one of these restricted headers in the WebHeaderCollection object associated with a WebClient object will throw an exception later when attempting to send the WebClient request.</p> <p>Restricted headers protected by the system include, but are not limited to the following:</p> <pre><code>Date Host </code></pre> <p>In addition, some other headers are also restricted when using a WebClient object. These restricted headers include, but are not limited to the following:</p> <pre><code>Accept Connection Content-Length Expect (when the value is set to "100-continue" If-Modified-Since Range Transfer-Encoding </code></pre> <p>The HttpWebRequest class has properties for setting some of the above headers. If it is important for an application to set these headers, then the HttpWebRequest class should be used instead of the WebRequest class.</p> </blockquote> <p>I suspect the reason for this is that many of the headers such as Date and host must be set differently on a different request. You should not be copying them. Indeed I would personally probably suggest that you should not be copying any of them. Put in your own user agent - If the page you are getting relies on a certain value then I'd think you want to make sure you always send a valid value rather than relying on the original user to give you that information.</p> <p>Essentially work out what you need to do rather than finding something that works and doing that without fully understanding what you are doing.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload