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 8609521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:53:59+00:00 2026-06-12T03:53:59+00:00

Lately I’m having ‘fun’ with web page scraping. Web site I want to work

  • 0

Lately I’m having ‘fun’ with web page scraping. Web site I want to work with has no API so I have no choice, I have to do that this way.

The one of the problems I have is reading HTML tree’s elements (I mean tags, inner texts and stuff like that). I use HttpWebRequest and HttpWebResponse to send GET/POST requests to server.

Having webResponse I can read HTML source code this way:

StreamReader sr = new StreamReader(webResponse.GetResponseStream(), Encoding.UTF8);
string sourceCode = sr.ReadToEnd();

What I need is value of this input tag:

<form action="/file.php" method="post">
    <input name="abc" id="abc" type="hidden" value="some_random_value" />
</form>

How can I do that?

  • 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-12T03:54:01+00:00Added an answer on June 12, 2026 at 3:54 am

    I would use HtmlAgilityPack

    string html = @"<form action=""/file.php"" method=""post"">
                    <input name=""abc"" id=""abc"" type=""hidden"" value=""some_random_value"" />
                    </form>";
    HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
    doc.LoadHtml(html);
    
    //Xpath
    var value1 = doc.DocumentNode.SelectSingleNode("//input[@id='abc']")
                                 .Attributes["value"].Value;
    
    //Linq
    var value2 = doc.DocumentNode.Descendants("input")
                    .First(i => i.Attributes["id"] != null && 
                                i.Attributes["id"].Value == "abc")
                    .Attributes["value"].Value;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lately my site has been getting hit by some people who have bots which
Lately all modern programming languages have a definitive web site to support, distribute, learn
Lately, I have taken to the pattern of having a lot of diagnostic logging
Lately I have been having more and more issues with the content assist in
lately I have been writing a lot of tiny plugins for my web projects
Lately I have seen many projects which have a web interface and backend in
lately I'm having the feeling that instances variables have the same problems of global
Lately I have been reading about web crawling, indexing and serving. I have found
Lately I have been using reflection to work in my project, and I have
Lately I have been trying my hands on Eclipse IDE for java development. I

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.