Search This Blog

Tuesday, September 13, 2011

HttpWebRequest in .net

HttpWebRequiest  request and responce from the server.


Uri objUri = new Uri(//Your Address from where u want httpresponce);

            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(objUri);

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            Stream resStream = response.GetResponseStream();

            StreamReader reader = new StreamReader(resStream);

            string resData = reader.ReadToEnd();//here u will get the response in the form of string

No comments:

Post a Comment