473,386 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to retrieve the title of a web page

In a Windows Forms application I want to get the title of a web page
when I know it's url. For example, the page which the url
"http://groups.google.com/" refers has the title "Google Groups". How
do I return "Google Groups" when I know only the url? Thanks.
Nov 15 '05 #1
2 1762
Mike,

If you don't have the page in a browser already, then you will have to
download the content from the page. You can use the HttpWebRequest and
HttpWebResponse classes to get the content. Once you have the content, you
will have to parse the HTML and get the contents of the <title> tag, which
is what is displayed in the browser title bar.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mike" <ml********@hotmail.com> wrote in message
news:47**************************@posting.google.c om...
In a Windows Forms application I want to get the title of a web page
when I know it's url. For example, the page which the url
"http://groups.google.com/" refers has the title "Google Groups". How
do I return "Google Groups" when I know only the url? Thanks.

Nov 15 '05 #2
It's right.
May be RegEx will help you to parse the page :-)
Something like this:
<(?<title>\b\w+\b)[^>]*>(?<text>.*?)</\k<\/title>>
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Info 3000 | last post by:
Hi there, Simple question, but headache ! I have a PHP Page like : <HTML> <HEAD> <TITLE>Sunny day !</TITLE> </HEAD>
2
by: Grant Merwitz | last post by:
I am trying to write an XML file from my database. Currently, i have this code on an ASPX page, but have also built a business layer that manages all the DataRetrieval and is reference in my main...
2
by: Frank | last post by:
Can I do this? I add a session var in C# and ultimatly want to pass it into a vbscript client side activeX control. This is what I have so far but get " Object Required:'name2' " error. Can...
2
by: Jaans | last post by:
hi, I need to retrieve the value of the tag TITLE, which gives the title of the html page using Java script. could anybody help me out in this reg. Thanks in advance, JL
1
by: whidbey | last post by:
Hello friends, I am whidbey, new to thescripts and dot net as well.I am working over Online Shopping Cart,web application.I design a page (webform5.aspx) where user search books then select the books...
0
by: whidbey | last post by:
Hello friends, I am whidbey, new to thescripts and dot net as well.I am working over Online Shopping Cart,web application.I design a page (webform5.aspx) where user search books then select the books...
1
by: divya | last post by:
Hello, I used the below code to move selected items between two listboxes Left and Right:- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestPopup.aspx.cs" Inherits="TestPopup" %> ...
4
by: Archanak | last post by:
Hi, I have table like this: select * from sampletest; | title ...
12
lifeisgreat20009
by: lifeisgreat20009 | last post by:
I am a newbie to Struts and JSP...I have been working on the code below for 5 hours now..I googled a lot but couldn't get much help so finally I am here.. Hoping of getting my problem solved. Please...
39
by: Kapil Choubisa | last post by:
Hi!!!!!!!! All, I am facing a problem to retrieving parent node. I have Child node already I am using Xpath. Here is my XML:::::: <book> <chapters>
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.