---
title: "HTML Agility pack with c#"  
description: "HTML Agility pack with c#"  
author: "Anonymous User"  
published: 2015-06-03  
updated: 2015-06-03  
canonical: https://www.mindstick.com/forum/23280/html-agility-pack-with-c-sharp  
category: "html"  
tags: ["c#", "html5"]  
reading_time: 1 minute  

---

# HTML Agility pack with c#

[c# code](https://www.mindstick.com/forum/403/how-to-export-data-in-excel-file-from-sql-server-using-c-sharp-code):`

```
var node = new HtmlWeb();                var doc = node.Load("http://ask.fm/");                HtmlNode ournode = doc.DocumentNode.SelectSingleNode("//div[@id='heads']")                textBox1.Text=ournode.InnerHtml;` html code ://< div id="heads" >       <a href="/sudenur3434" data-rlt-aid="welcome_head"><img alt="" class="head" id="face_30132803" src=" thumb_tiny/IMG_20150513_192250.jpg" /></a>      <a href="/leylaulucay" data-rlt-aid="welcome_head"><img alt="" class="head" id="face_56578735" src="thumb_tiny/11094711_919135961470973_149663457_njpg720960png1280963.png" /></a>
```

I want to see the following in the [text](https://www.mindstick.com/blog/301635/did-people-reinvent-texting-to-express-the-full-range-of-emotions) box

/sudenur3434

/leylaulucay

## Replies

### Reply by Anonymous User

I have added an additional line to your [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii):

```
var node = new HtmlWeb();var doc = node.Load("http://ask.fm/");HtmlNode ournode = doc.DocumentNode.SelectSingleNode("//div[@id='heads']")var val = ournode.Attributes["href"].Value;textBox1.Text=val;
```

This would let you get the href attribute. Simply use the same code to get the other nodes href value and then add them to your textbox


---

Original Source: https://www.mindstick.com/forum/23280/html-agility-pack-with-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
