views:

278

answers:

1

First of all, I wrote a simple php page, that picks up some variables from the POST parameters such as a query and a authentication string, and returns the result as xml. I intend to call this page with the WebClient class from a Silverlight application. I'm using POST because we are querying the database with any valid sql statement, not only select statements. The WebClient class uses the UploadDataAsync method to post to a http server, however it requires the post parameters be passed as a NameValueCollection. This class is missing in the Silverlight runtime. How do I proceed???

+1  A: 

Use the WebRequest API instead of the WebClient API.

var request = WebRequest.Create(requestUriString);

request.Method = "POST";

request.BeginGetRequestStream()
Michael S. Scherotter
This is so much more complicated than WebClient (http://msdn.microsoft.com/en-us/library/system.net.webrequest.begingetresponse(VS.71).aspx).
cmaduro
Actually I meant the headers. I know hot to set the method, but how do I set the headers?
cmaduro