Hi,
I want to simulate the behaviour of the WebTestRequest class (in Visual Studio's Test Tools framework) where it can invoke dependent requests based on resources that are referred to in the response that is obtained from the original request.
For example, if I issue a web request and get the response by doing this:
string url = "http://www.mysite.com";
WebRequest request = WebRequest.Create(url);
using (WebResponse response = request.GetResponse())
{
StreamReader reader = new StreamReader(response.GetResponseStream());
string responseText = reader.ReadToEnd();
}
I would like to be able to parse responseText
and see if there are any requests to other resources (like js/css files, images, etc.)
Is there an easy way of doing this? I hesitate to manually do this, as some of the resource requests may be set up programmatically and may not be obvious on a straightforward text parse.