c# make http request
private static readonly HttpClient client = new HttpClient();
var responseString = await client.GetStringAsync("http://www.example.com/recepticle.aspx");
c# make http request
private static readonly HttpClient client = new HttpClient();
var responseString = await client.GetStringAsync("http://www.example.com/recepticle.aspx");
C# HttpClient POST request
using System;
using System.Text;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace HttpClientPost
{
class Person
{
public string Name { get; set; }
public string Occupation { get; set; }
public override string ToString()
{
return $"{Name}: {Occupation}";
}
}
class Program
{
static async Task Main(string[] args)
{
var person = new Person();
person.Name = "John Doe";
person.Occupation = "gardener";
var json = JsonConvert.SerializeObject(person);
var data = new StringContent(json, Encoding.UTF8, "application/json");
var url = "https://httpbin.org/post";
using var client = new HttpClient();
var response = await client.PostAsync(url, data);
string result = response.Content.ReadAsStringAsync().Result;
Console.WriteLine(result);
}
}
}
https request c#
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://requestbin.net/r/xxxxxxxx?" + textBox2.Text);
req.GetResponse();
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us