WebClient.UploadData correct usage for post request

前端 未结 1 1458
囚心锁ツ
囚心锁ツ 2020-12-18 04:44

i think i am going a bit crazy, when i test this on my local webserver, it works fine when i go out to the live website, it returns a blank string instead of the data i am e

相关标签:
1条回答
  • 2020-12-18 04:58

    It really depends what you are trying to do... I'm not sure, for example, why you are url-encoding data in the body. An easier way to post key/value pairs is with UploadValues;

    NameValueCollection inputs = new NameValueCollection();
    string value = ...
    inputs.Add("data", value);
    webClient.UploadValues(address, inputs);
    
    0 讨论(0)
提交回复
热议问题