Upload the specified string to the specified resource, using the POST method in CSharp

Description

The following code shows how to upload the specified string to the specified resource, using the POST method.

Example


using System;//from   w  w w.  j  a v a  2 s .  c  o  m
using System.Net;
using System.Net.Sockets;

public class Example
{
   public static void Main()
   {
        string data = "data";
        WebClient client = new WebClient ();

        client.Encoding = System.Text.Encoding.UTF8;

        string reply = client.UploadString (new Uri("http://your server"), data);

        Console.WriteLine (reply);
    
   }
}




















Home »
  C# Tutorial »
    Network »




IP
Web Client