1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Get the content of a web document

Discussion in 'C, C++, C#' started by mgaft1, Apr 3, 2009.

  1. mgaft1

    mgaft1 Newbie

    Joined:
    Oct 12, 2008
    Messages:
    22
    Likes Received:
    1
    Hi there,

    I am using C#, specifically WebBrowser Component, to scan page content and, for the sake of this example to place all the HTMLElements in the ListView.

    What I am doing essentially is:

    1. Navigating to the page.
    2. setting HtmlDocument variable to Page Document
    ? HtmlDocument wDoc = wb2.Document;
    3. Scan through all the elements of the document
    ? for (int i=0;i<wDoc.All.Count;i++)
    4. set HtmlElement variable
    ? HtmlElement el = wDoc.All;
    5. populate the listView with element's name,id and Value
    ? ListViewItem item1 = new ListViewItem(i.ToString(), i);
    ? item1.Checked = true;
    ? item1.SubItems.Add(el.GetAttribute("name"));
    ? item1.SubItems.Add(el.GetAttribute("id"));
    ? item1.SubItems.Add(el.GetAttribute("value"));
    ? lv1.Items.Add(item1);
    ?

    Now, this works fine, but I have difficulties with IE6 that is what this Browser Component is based upon. So I would much rather used FireFox. Here comes my question. How can I reach the same objectives using ASP.NET. Well actually it doesn't have to be ASP.NET specifically. As long as I would understand the principle of how this type of logic would work within the Browser. I hope I am making myself clear. In Window application I have a control over the browser component because it's built in the window form. So once I travel to someone else's application like CL I can do things to a page. But if I am within the regular browser, once I am at someone else's site I pass the control to that site.

    Thank you
     
  2. andyred

    andyred Junior Member

    Joined:
    Oct 17, 2007
    Messages:
    137
    Likes Received:
    16
    sorry dude, you're on a wrong forum
     
  3. iPwnJ00

    iPwnJ00 Junior Member

    Joined:
    Mar 10, 2009
    Messages:
    132
    Likes Received:
    21
    Location:
    Melbourne, Australia
    *EDIT*

    Sorry, you have a misleading thread title.
     
  4. xbada

    xbada Junior Member

    Joined:
    Jul 31, 2009
    Messages:
    102
    Likes Received:
    118
    Occupation:
    full time im
    Location:
    usa
    It would require you to isolate the cookies and other pertinent information in use on the site in your regular browser, and port them to your software and continue your session with the cloned cookies... although I may have misunderstood you.