run/call a page remotely

Asked

Viewed 1,057 times

0

I want to run a remote page, I don’t care what this page does, I just need to run it and wait for it to load 100% to run another, and so on.

I don’t need to recover any information from that page.

It can be in Windows.Form, Console App. with any component, etc. I tried with Xmldocument, Restsharp and nothing.

Today the only way I could was with webbrowser, but I made manual buttons, I could not make him understand when the page is 100% loaded.

2 answers

1


0

Thank you very much.

So that’s the code to read the page as I needed it:

He reads 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;
            }
  • 1

    Cool. If it takes too long, you can use the Async method, which you can process in parallel.

  • would it be possible for you to show me something how you could do the above code with Async seems to me to be very promising the Async

  • 1

    You have to sign the event OnOpenReadCompleted and call the method OpenReadAsync(). When you finish reading the page, it will run the event. If you don’t need to wait until you finish reading to do something, just call the method and you’re done.

  • Just one more remark about the community. In cases you want to add information, always use the option to edit your question. This space is intended for answers, blz?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.