1

So my c# application downloads a page from my website, that's fine and all but i want to control what values it downloads, as an example, i have a page that has 2 buttons, 'run' and 'stop', depending on which button i click, it sets the title of the page, i want the c# application to download the page and either get 'run' or 'stop' but heres the problem.... im only getting the default set value 'My title' instead of the buttons values... i asked other people and they told me you need to make a dynamic/server-side page, but im not sure how to do it...

here's the page (index.html)

    <!DOCTYPE html>
        <html>
        <head>
        <title>My title</title>
        </head>
        <body>
        <button onclick="myFunction()">Run</button>
        <button onclick="myFunction2()">Stop</button>

        <script>
        function myFunction() {
        document.title = "run";
        }
        function myFunction2() {
        document.title = "stop";
        }
        </script>
        </body>
        </html>

so yea i click 'run' or 'stop' and that sets the name of the title, however, c# application downloads page and does not *consider the button change effect

static void Main(string[] args)
    {
        WebClient web = new WebClient();
        String html = web.DownloadString("http://www.adanyeva.org");
        MatchCollection m1 = Regex.Matches(html, @"<title>\s*(.+?)\s*</title>", RegexOptions.Singleline);

        //html text: <strong>Tampa, FL</strong>
        // \s*: multiple spaces til it finds something
        //(.+?): look for any character
        //var kim = m1[0];

        Console.WriteLine(m1[0]);
        Console.ReadKey();
    }

when this runs, i get this output:

<title>My title</title>

what should have been outputted:

<title>run</title>

or

<title>stop</title>

0 Answers0