execute / call a page remotely

0

I want to run a remote page, I do not care what this page does, I just need to run it and expect it to load 100% to run another, and so on.

I do not need to retrieve any information from this page.

Can be in Windows.Form, Console App. with any component, etc. I tried with XmlDocument, RestSharp and nothing.

Today the only way I managed was with webbrowser, but I made manual buttons, I could not get it to understand when the page is 100% loaded.

    
asked by anonymous 27.03.2014 / 15:40

2 answers

1

You can use the WebClient class: link

using(var wc = new WebClient())
{
    wc.OpenRead("urlAqui");
    // ou
    // wc.DownloadString("urlAqui");
}

This class has several useful methods to explore, take a look at the link.

    
27.03.2014 / 15:46
0

Thank you very much.

So I got the code to read the page, as I needed it:

It gives you the page, I need to test with a large page that takes around 2min, to be executed.

  string url = "http://www.url.com.br";
            using (var wc = new WebClient())
            {
                Stream data = wc.OpenRead(url);
                StreamReader reader = new StreamReader(data);
                string s = reader.ReadToEnd();

                textBox1.Text = s;
            }
    
27.03.2014 / 16:53