Validating URLs

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My app validates web page URLs by using the HttpWebRequest/WebResponse .NET
classes. If URL is ok I'd like to present the user with the title of the web
page.

Anybody knows how to programmatically pick this from the response strem (if
its there at all)?

Bevo
 
Bevo,

You could pass the stream to MSTML (you will have to access this through
COM interop). Then, once you have done that, you can access it through the
object model.

Hope this helps.
 
Bevo,
Whenever I need to do this type of Web-scraping, getting a particular
element value, etc. I almost always use Simon Mourier's HtmlAgilityPack. It
features an HtmlDocument class that derives from IXPathNavigable which
essentially means your whole web page is the same as an XmlDocument. So, you
could do:

HtmlNode nod=myDoc.DocumentElement.SelectSingleNode("//title");

And then you can get the text, any attributes, etc. with the normal XPath
constructs.
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top