locked
WebClient issue with Internet Explorer not POSTING data RRS feed

  • Question

  • Dear all,

    I am using WebClient to POST data to a php page, which in turn uses this POST data to make MySQL queries on behalf of Silverlight, which in turn gets the result from the source code of the php site. Everything works fine and dandy in Google Chrome, but when I use IE, nothing is being POSTED.

    My code is like this:

    WebClient client = new WebClient();
                WebClient client2 = new WebClient();
                client.UploadStringCompleted += new UploadStringCompletedEventHandler(client_UploadStringCompleted);
                client.UploadStringAsync(new Uri("http://sveskekat.dk/kk32beer.php"), "POST", "action=5");

    WebClient client = new WebClient();
    client.UploadStringCompleted += new UploadStringCompletedEventHandler(client_UploadStringCompleted);
    client.UploadStringAsync(new Uri(myUri), "POST", "action=5");

    I tried dumping the content of var_export($_GET, true)."\n".var_export($_POST, true); in php. When I use IE, it gives an empty "array ()" while in Chrome it will dump "array ('action' => '1',)", so it seems something here is wrong, but I dont know where the problem is.

    Needless to say, this is rendering my Silverlight app useless in IE.

    Please help.




    Sunday, February 13, 2011 11:01 AM

Answers

  • I had forgotten to set 

    client.Headers["Content-Type"] = "application/x-www-form-urlencoded";

    Tuesday, February 15, 2011 5:46 AM