WebClient.UploadValues : WebClient « System.Net « C# / C Sharp by API






WebClient.UploadValues

 


using System;
using System.Collections.Specialized;
using System.Net;
using System.Text;

public class UploadValuesTest
{
   public static void Main(string[] argv)
   {
      WebClient wc = new WebClient();
      string uri = "http://localhost/testform.aspx";

      NameValueCollection nvc = new NameValueCollection();

      nvc.Add("lastname", "Blum");
      nvc.Add("firstname", "Rich");

      byte[] response = wc.UploadValues(uri, nvc);
      Console.WriteLine(Encoding.ASCII.GetString(response));
   }
}

   
  








Related examples in the same category

1.WebClient.BaseAddress
2.WebClient.Credentials
3.WebClient.DownloadData
4.WebClient.DownloadFile
5.WebClient.DownloadString(Uri u)
6.WebClient.Headers
7.WebClient.OpenRead(String url)
8.WebClient.OpenWrite
9.WebClient.ResponseHeaders
10.WebClient.UploadData