views:

27

answers:

1

I have a process that retrieves html from a remote site and parses it. I pass several URL's into the method, so I would like to ajaxify the process and give a screen notification each time a URL completes parsing. For example, this is what I am trying to do:

List<string> urls = ...//load up with arbitary # of urls

foreach (var url in urls)
{
    string html = GetContent(url);
    //DO SOMETHING
    //COMPLETED.. SEND NOTIFICATION TO SCREEN (HOW DO I DO THIS)
}

public static string GetContent(string url)
{
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
    request.Method = "GET";

    using (var stream = request.GetResponse().GetResponseStream())
    {
        using (var reader = new StreamReader(stream, Encoding.UTF8))
        {
            return reader.ReadToEnd();
        }
    }
}

In each iteration in the loop, I want to show the URL was completed and moving on to the next one. How can I accomplish this?

A: 
josh3736