How to get and process the response to a request

Hi,
Thanks for the reply to my earlier question. Looking at the generate code option gave me a pretty good idea of how a request should be made. I have some more questions, however. Please bear with me with they sound trivial.

1. I would also like to be able to see the response sent by the server in reply to my request. And get some information from the response such as status codes etc. From the API, I know I can get certain information from the response. But what I don't know to do is how to get to the response, and how to parse it, when I make a request to a web server?


2. If 'request2' is a request I send to the server, is 'yield return request2' the statement that is actually responsible for sending the request to the server? If not, what is the purpose of the 'yield' statement and which statement is responsible for sending the request.
TIA,
Sree

[1171 byte] By [SreeD] at [2007-12-16]
# 1
1. You can write response handlers which will allow you to access the response info you are interested in. you can have individual handlers or have all requests use the same handler. Here is an example of what it looks like:

public override IEnumerator<WebTestRequest> GetRequestEnumerator()

{

WebTestRequest request1 = new WebTestRequest("URL");

request1.PostRequest += new EventHandler<PostRequestEventArgs>(request1_PostRequest);

yield return request1;

}

void request1_PostRequest(object sender, PostRequestEventArgs e)

{

e.Response.StatusCode;

}

2. Yes yield is the statement that returns the request. The yield return syntax is used for implementing enumerators.

slumley at 2007-9-9 > top of Msdn Tech,Visual Studio Team System,Visual Studio Team System - Web and Load Testing...

Visual Studio Team System

Site Classified