Making HTTP Requests Without a Browser
Expains how to Making HTTP Requests Without a Browser through program.
Create one console project.and few lines of code given below.
Using System.Net;
using System.IO;
static void Main(string[] args)
{
WebRequest req = WebRequest.Create("http://www.google.com");
WebResponse response = req.GetResponse();
StreamReader sr = new StreamReader(response.GetResponseStream(),Encoding.ASCII);
Console.WriteLine(sr.ReadToEnd());
}
And see the output in console window.
hi Bommala
I tried u'r code but i am getting following error.Can u correct me
Unhandled Exception: System.Net.WebException: The remote name could not be resol
ved: 'www.dotnetspider.com'
at System.Net.HttpWebRequest.GetResponse()
at ConsoleApplication25.Program.Main(String[] args) in C:\Documents and Setti
ngs\house\My Documents\Visual Studio 2008\Projects\ConsoleApplication25\ConsoleA
pplication25\Program.cs:line 30
Press any key to continue . . .