Posting Data to a URL using WebClient in C#

This content was proof-read by Grammarly. You can Try Grammary for FREE

Below is a sample code snippet demonstrating the usage of the WebClient to post data to the server in C#.

How to Post data to a URL using WebClient in C# ?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;

namespace ACCode
    class Program
        static void Main(string[] args)
            string Uri = "";
            string params1 = "author=GoogleMVP";

            using (WebClient webClientInstance = new WebClient())
                webClientInstance.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
                string result = webClientInstance.UploadString(Uri, params1);
%d bloggers like this: