using System.Net;
HttpWebRequest req = default(HttpWebRequest);
We will then have an object equal to a new HTTPWebRequest with the function of '.Create()' while parsing it the server URL.
req = HttpWebRequest.Create("http://www.google.com");
3. This is the code for response.
We will create an object to hold the response. This object is the type of HTTPWebResponse. To initialize, have this code:
HttpWebResponse res = default(HttpWebResponse);
Now, we will set the response object to the request's response.
res = req.GetResponse();
From this we can use that response to do things such as get the source of the response in a web page from the request server.
{ MessageBox.Show((string) (reader.ReadToEnd())); //Source }
using System.Net; using System.Windows.Forms; public class Form1 { private void Form1_Load(object sender, EventArgs e) { HttpWebRequest req = default(HttpWebRequest); req = HttpWebRequest.Create("http://www.google.com"); HttpWebResponse res = default(HttpWebResponse); res = req.GetResponse(); { MessageBox.Show((string) (reader.ReadToEnd())); //Source } } }