Answers for "c# make http request"

C#
2

c# make http request

private static readonly HttpClient client = new HttpClient();

var responseString = await client.GetStringAsync("http://www.example.com/recepticle.aspx");
Posted by: Guest on March-08-2020
1

how to POST in c#

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

namespace API_Console_App
{
    class Program
    {
        static void Main(string[] args)
        {
            // Declare the API Endpoint URL
            string url = "URL_HERE";

            // Create a New WebClient
            WebClient client = new WebClient();

            // Create a New NameValueCollection
            NameValueCollection values = new NameValueCollection();

            // Add Data to the NameValueCollection
            values.Add("data-name", "content");

            // Upload the NameValueCollection Values to the URL
            client.UploadValues(url, values);
        }
    }
}
Posted by: Guest on January-31-2021

C# Answers by Framework

Browse Popular Code Answers by Language