Jennifer S
Jennifer S

Reputation: 1

Get the title of a webpage using HttpWebRequest

I am trying to get the text in the title tag on a website using HttpWebRequest in VB.Net.

Is it possible to retrieve the text with HttpWebRequest and/or HttpWebResponse?

Upvotes: 0

Views: 312

Answers (2)

peterG
peterG

Reputation: 1641

have a look at webclient.DownloadString. This should retrieve your webpage as a string within which you can locate the title tags.

Upvotes: 1

SLaks
SLaks

Reputation: 887275

The HttpWebRequest classes are about sending HTTP requests.
They don't know anything about HTML.

Instead, you need to use an HTML parser, such as HTML Agility Pack.

Upvotes: 2

Related Questions