Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8774779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:39:11+00:00 2026-06-13T18:39:11+00:00

I want to extract Title, Description & images from URL using HTML Agility utility

  • 0

I want to extract Title, Description & images from URL using HTML Agility utility so far i am not able to find an example which is easy to understand & can help me to do it.

I would appreciate if some can help me with example so that i can extract title, description & give user choice to select image from series of image (some thing similar to Facebook when we share a link).

Updated:

I have place a label for title, desc and a button , textbox on the .aspx page & i fire following code on button click event. but it return null for all values. may be i am doing something wrong.

i used following sample URLhttp://edition.cnn.com/2012/10/31/world/asia/india/index.html?hpt=hp_t2

protected void btnGetURLDetails_Click(object sender, EventArgs e)
{
    HtmlDocument doc = new HtmlDocument();
    var response = txtURL.Text;
    doc.LoadHtml(response);

    String title = (from x in doc.DocumentNode.Descendants()
                    where x.Name.ToLower() == "title"
                    select x.InnerText).FirstOrDefault();

    String desc = (from x in doc.DocumentNode.Descendants()
                   where x.Name.ToLower() == "description"
                   select x.InnerText).FirstOrDefault();

    List<String> imgs = (from x in doc.DocumentNode.Descendants()
                         where x.Name.ToLower() == "img"
                         select x.Attributes["src"].Value).ToList<String>();

    lblTitle.Text = title;
    lblDescription.Text = desc;
}

Above code gets me null value for all variable

if i modify the code with this

HtmlDocument doc = new HtmlDocument();
        var url = txtURL.Text;

        var webGet = new HtmlWeb();
         doc = webGet.Load(url);

in this case it only get me value for title & description is null again

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:39:12+00:00Added an answer on June 13, 2026 at 6:39 pm
    protected void btnGetURLDetails_Click(object sender, EventArgs e)
    {
        HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri(txtURL.Text));
        request.Method = WebRequestMethods.Http.Get;
    
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    
        StreamReader reader = new StreamReader(response.GetResponseStream());
    
        String responseString = reader.ReadToEnd();
    
        response.Close();
    
        HtmlDocument doc = new HtmlDocument();
        doc.LoadHtml(responseString);
    
        String title = (from x in doc.DocumentNode.Descendants()
                    where x.Name.ToLower() == "title"
                    select x.InnerText).FirstOrDefault();
    
        String desc = (from x in doc.DocumentNode.Descendants()
                   where x.Name.ToLower() == "meta"
                   && x.Attributes["name"] != null
                   && x.Attributes["name"].Value.ToLower() == "description"
                   select x.Attributes["content"].Value).FirstOrDefault();
    
        List<String> imgs = (from x in doc.DocumentNode.Descendants()
                         where x.Name.ToLower() == "img"
                         select x.Attributes["src"].Value).ToList<String>();
    
       lblTitle.Text = title;
       lblDescription.Text = desc;
    

    }

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want extract the path of images from a html page using PHP-preg_match_all(), the
I want a regular expression to extract the title from a HTML page. Currently
Possible Duplicate: How to extract img src, title and alt from html using php?
I want to extract the meta-tags from an url, especially the title and the
I want to extract the store/brand names out of the url or some title
I want to extract information from Twitter using Python. There is a page with
I want to extract an IP address from a string (actually a one-line HTML)
I have following string task BLABLA@{taskId} @{BLABLA.title} and want to extract all placeholders from
I'm trying to find a away to extract a site title from a URL
Sorry if the title isn't descriptive enough. I want to be able to extract

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.