ITTreats.com
Enter your Search term and Hit "Enter"

Sat, 20 Mar 2010 12:23:44 PM +00:00

Latest 'ITTreats'


Processing Web Request from c#.net/vb.net

Processing Web Request  from c#.net/vb.net

To process  web request from c#.net/vb.net windows application we have  WebRequest Class.

import  System.Net,System.IO name spaces  for requesting and processing the result

here is the example code

1. create a uri with the required URL   Uri wsn=new Uri(\”http://www.ITTreats.com\”);

2.Next  create a webRequest class and pass the above uri object to it   WebRequest wr=WebRequestFactory.Create(wsn)

3.  Now, capture the response of the  address   WebResponse wresp = Wr.GetResponse();

4. assaign the data to stream   StreamReader  sr=new StreamReader(wresp.GetResponseStream(), Encoding.ASCII);

5. Proceed with your further  coding requirements