simple http request c#

104

simple http request c# -

using System.Net;

var url = "http://webcode.me";

var request = WebRequest.Create(url);
request.Method = "GET";

using var webResponse = request.GetResponse();
using var webStream = webResponse.GetResponseStream();

using var reader = new StreamReader(webStream);
var data = reader.ReadToEnd();

Console.WriteLine(data);

Comments

Submit
0 Comments