Connecting Tech Pros Worldwide Help | Site Map

How do i do two consecutive WebRequest.GetResponse ?

Newbie
 
Join Date: Nov 2009
Posts: 3
#1: 3 Weeks Ago
i'm new to c#

the following is my code:
******************************************
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("http://www.google.com");

HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
myResponse.Close();

myRequest = (HttpWebRequest)WebRequest.Create("http://www.mns.com");
myResponse = (HttpWebResponse)myRequest.GetResponse();
myResponse.Close();
*******************************************
It works for the first site. i can read the contents of the myRequest object. But i get an error when i try to get the response of the second site.

so how do i get a request from 2 sites? (i'm planning to check for more)
Reply

Tags
asp .net, http, server, webrequest, webresponse