WebClient Does not Send HTTP Headers By Default

Wednesday, June 18, 2008 • edited Friday, February 7, 2020

Something to keep in mind as you are coding your Silverlight 2 Beta 2 applications is that the WebClient does not send any HTTP Headers by default. If you need some headers you must explicitly add them. For example, if you have a form you wrote in Silverlight and you need to post that data off to a web service or a POX page what you need to do is add something like this right after you initialize your WebClient (in this case the WebClient is called request):

request.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";

HTH

Silverlight

Silverlight.js V1 to V2 Change in Functionality

IE6 Is Now Dead to Me