Temo Gelashvili
Temo Gelashvili

Reputation: 13

How load html from URL?

i have problem and if someone can help me please. i want to load html.

var webGet = new HtmlWeb();
var doc = webGet.Load(@"https://example.com/search_engine/jobs.cgi?owner=5027409&ownertype=fair&posting_code=612");

i using htmlagilitypack but it can't load html. I download html in my local PC and it load from there.

Many Thanks.

Upvotes: 0

Views: 5154

Answers (1)

mwilczynski
mwilczynski

Reputation: 3082

You're overdoing it a little. All you need is:

//using for IDisposable.Dispose()
using (WebClient client = new WebClient())
{
    string html = client.DownloadString("http://stackoverflow.com");
    //Do something with html then
}

Upvotes: 2

Related Questions