Guest User

Untitled

a guest
May 21st, 2012
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. C# POSTing values from NameValueCollection
  2. public static string Post (string url, NameValueCollection formData)
  3. {
  4. string response;
  5. int length = formData.???
  6.  
  7. using (WebClient webClient = new WebClient())
  8. {
  9. webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
  10. webClient.Headers.Add ("Content-Length", length);
  11. byte[] responseBytes = webClient.UploadValues (url, "POST", formData);
  12. response = Encoding.UTF8.GetString (responseBytes);
  13. }
  14.  
  15. return response;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment