HTML Visualizer

Joe Montgomery 6 Reputation points
2021-05-14T02:45:53.16+00:00

I am trying to access content on a website page using:

Uri uri = new Uri("http://www.xyz.com/abc");            // just a psuedo website
HtmlWeb web = new HtmlWeb();
HtmlAgilityPack.HtmlDocument doc = web.Load(uri);

Using the debugger, I look at doc.Text with the HTML visualizer and get a window saying:

'your web browser has restricted this file from showing active content .... Click here for options'

I click there & get a drop down menu saying 'allow blocked content'. I click & get a message saying:

'Allowing script or ActiveX controls can be useful ....... Are you sure you want to let this file run active content'

I click Yes & then see the website page content in human readable form - all well & good.

But, I want to programmatically access the page content - specifically searching each line for a certain word.

Is this doable?? I don't have a clue if it is nor do I have the foggest idea of where to start.

Any help will be much appreciated -- TIA Joe

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,446 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Yijing Sun-MSFT 7,076 Reputation points
    2021-05-14T09:07:17.01+00:00

    Hi @Joe Montgomery ,
    Your codes are load the doc.If you want to search,you could use "contain()" .You could refer to below articles:
    https://stackoverflow.com/questions/846994/how-to-use-html-agility-pack
    https://stackoverflow.com/questions/33834908/html-agility-pack-search-through-site-for-a-specified-string-of-words
    Best regards,
    Yijing Sun


    If the answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our  documentation  to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Joe Montgomery 6 Reputation points
    2021-05-15T03:43:58.863+00:00

    I read the links, but no help. I believe doc.Text is a script that needs to run to reveal the page contents.

    Tried to upload doc.Text, but site will not allow for some stange reason. Neither could I attach a file
    named Prime.txt


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.