Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- C# POSTing values from NameValueCollection
- public static string Post (string url, NameValueCollection formData)
- {
- string response;
- int length = formData.???
- using (WebClient webClient = new WebClient())
- {
- webClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
- webClient.Headers.Add ("Content-Length", length);
- byte[] responseBytes = webClient.UploadValues (url, "POST", formData);
- response = Encoding.UTF8.GetString (responseBytes);
- }
- return response;
- }
Advertisement
Add Comment
Please, Sign In to add comment