title: Request GZipped content in Silverlight
body: <p>I'm having trouble to request Gzipped content with Silverlight 5. To reduce used bandwidth I want to use gzip for the content that's requested from our webservice, but unfortunately this does not work.</p>
  
  <p>I'm using the Client Stack and send a HttpWebRequest. I tried to set the Accept-Encoding header, but it tells me that I'm not allowed to change this directly - and there's no other property for it!</p>
  
  <p>So how can I send a custom Accept-Encoding header?</p>
  
  <p>This is the code I have in my App-Constructor:</p>
  
  <pre><code>WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
  WebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp);
  </code></pre>
  
  <p>This is how I create the request and set the header:</p>
  
  <pre><code>var webRequest = (HttpWebRequest)WebRequest.Create(requestUri);
  webRequest.Headers["Accept-Encoding"] = "gzip, deflate";
  </code></pre>
  
  <p>This is the exception:</p>
  
  <pre><code>{System.ArgumentException: The 'Accept-Encoding' header cannot be modified directly.
  Parameter name: name
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
     at MyClass}
  </code></pre>