sam
sam

Reputation: 1

unable to get source code of page aspx webpages

Im trying to get source code of the page but some pages im not able to get source code through C# code im using

here is my code

      private void button1_Click(object sender, EventArgs e)
    {
        using (var client = new WebClient())
        {
            string html = client.DownloadString("http://www.acusports.com/roster.aspx?roster=154&path=baseball");
            html = textBox1.Text;
        }
    }

Upvotes: 0

Views: 226

Answers (2)

Seth Flowers
Seth Flowers

Reputation: 9190

What happens when you switch the following statement:

html = textBox1.Text;

to this:

textBox1.Text = html;

In your code, you are setting the html string to whatever you retrieve, and then you are immediately overwriting it with the value of textBox1.Text.

Upvotes: 1

KadekM
KadekM

Reputation: 1013

didn't you want to write:

textBox1.Text = html; 

Upvotes: 0

Related Questions