Answers for "c# make httprequest"

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
0

how to make a webrequest in c#

Uri ourUri = new Uri(url);            

// Create a 'WebRequest' object with the specified url. 
WebRequest myWebRequest = WebRequest.Create(url); 

// Send the 'WebRequest' and wait for response.
WebResponse myWebResponse = myWebRequest.GetResponse(); 

// Use "ResponseUri" property to get the actual Uri from where the response was attained.
if (ourUri.Equals(myWebResponse.ResponseUri))
    Console.WriteLine("nRequest Url : {0} was not redirected",url);   
else
    Console.WriteLine("nRequest Url : {0} was redirected to {1}",url,myWebResponse.ResponseUri);   
// Release resources of response object.
myWebResponse.Close();

// IGNORE - RC
Posted by: Guest on July-13-2021

C# Answers by Framework

Browse Popular Code Answers by Language