samedi 22 août 2015

how to load webpage using c#

IDE: VS 2010, C# .net 4.0

Hi,

I am trying to open oneplus invite page using following way:

private void btnOpenPage_Click(object sender, EventArgs e)
    {

        LoadPage();

    }

 private void LoadPage()
    {
        WebBrowser webBrowser1 = new WebBrowser();

        webBrowser1.Navigate("http://ift.tt/1D10dJZ");

        //Wait for document to load...
        while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
        {
            Application.DoEvents();
        }

        //Set the text of the search input

        string htmlText = webBrowser1.DocumentText;

        using (StreamWriter file = new StreamWriter(@"D:\oneplus.htm",false))
        {
            file.Write(htmlText);
        }

        Process.Start(@"D:\oneplus.htm");

As this page is opening in Chrome and firefox, but I am not able to load it in programmatically, also this page is not able to open in Internet Explorer.

So guys, can you help me to open this page programmatically.




Aucun commentaire:

Enregistrer un commentaire