Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A Simple Get Request in C#
public static void RequestWeather()
const string url = "";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
var webResponse = request.GetResponse();
var webStream = webResponse.GetResponseStream();
var responseReader = new StreamReader(webStream);
var response = responseReader.ReadToEnd();
Console.WriteLine("Response: " + response);

This comment has been minimized.

Copy link

cw-arvindkumar commented Oct 11, 2019

it will not work if pass # in url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.