Saturday, November 24, 2012

HTTP request without browser

For this we use WebRequest class.This class  has a GetResponse() method that is used to send request to the address specified by URL.

Steps to be followed:
1.Start Visual Studio and open Console Application.
2.Add two namespaces using System.Net and using System.IO.
3.Add following code mentioned in the below screenshot in method
static void Main(string[] args){}

4.Run the program by pressing Ctrl+F5.Visual Studio starts a Console for us and runs the program.After a couple of moments, we can see some HTML on your screen.

No comments:

Copyright © Codingnodes,2014.All Rights Reserved.