WebClient and ResponseUri

Jan 2 2009 12:27 PM

Hi,

I recently wrote a simple spider tool, but have a problem.. I am using the WebClient class and DownloadStringAsync to pull the text from web pages, then parsing them with regex for links, the problem is that some pages are script forwarders, and I need to get the ResponseUri property in order to build the new Uri's in the list. I know that there are different models for async downloads that can do this, or that I can use GetResponse post-callback to retrieve the responders Uri, but that is time consuming, and defeats the purpose of using DownloadStringAsync which seems to be one of the faster methods. One thing I had noticed is that the ResponseUri property is there in the sender object of the DownloadStringCompleted delegate, but it is listed as a 'Non-Public member'. Is there a way to extract this value, either through reflection or by creating a derived class? I have been trying, but thus far, no joy..

 

Thanks,

John


Answers (1)