views:

21

answers:

2

usually when v get the response. the html is without the ajax response. coz it is requested latter. but i want the source of the page containing the ajax request's response.

A: 

You can use fiddler to get the content of all requests/responses: http://www.fiddler2.com/fiddler2/

Andrew Barber
but i want to get the html source of the page in code...
vakas
That lets you do exactly what you want; It shows you what is being sent over the wire for regular and AJAX requests/responses both.
Andrew Barber
A: 

You need to mention what type of ajax operations you are using. If its not update panel related / don't include ViewState and anything that makes it hard to handle in the page, then you can just make a separate request for the ajax resource just like the page does. Use fiddler to see what is sent in those ajax requests.

If the above don't fit the bill, then use WatiN or Selenium instead of HttpWebRequest to hit the page. That is slower than the simple direct requests, but it'll actually execute the page in the context of a browser and let you do pretty much anything the user does (well, highly limited if things like silverlight,flash, etc are involved).

eglasius