Solved

Using the MSHTML collection with a string containing HTML

Posted on 2006-06-17
5
297 Views
Last Modified: 2008-01-09
I'm request html using the following method,


      Dim sResult As String
                        Dim oHttp As HttpWebRequest
                        Dim objResponse As WebResponse
                        Dim objRequest As WebRequest = System.Net.HttpWebRequest.Create(EventUrl)




                        objRequest.Method = "GET"
                        objRequest.Timeout = 120000 ' 20 sec.
                        objResponse = objRequest.GetResponse

                        Dim sr As System.IO.StreamReader = New System.IO.StreamReader(objResponse.GetResponseStream(), System.Text.Encoding.UTF7)

                        sResult = sr.ReadToEnd()
                        ' Close and clean up the StreamReader
                        sr.Close()

debug.write(sresult.tostring)

                        Dim DOCHTML As String
                        doc = DirectCast(sResult, mshtml.HTMLDocument)
                        dochtml = doc.documentElement.innerHTML()
                        Debug.Write(DOCHTML)


This doesn't seem to convert the html string so that it can be used with the mshtml collection. If I choose to display the html after it finishes with debug.write(sresult.tostring) it will output to the debug window. But when I try to output it with  Debug.Write(DOCHTML) it won't work. 500 points because I'm trying to finish the development of this application within the next few weeks. thanks guys.


0
Comment
Question by:JPERKS1985
  • 4
5 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 16934761
Here is a class that I use, instead of an HttpWebRequest to parse an HTML document:

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/Q_21767542.html

Bob
0
 
LVL 1

Author Comment

by:JPERKS1985
ID: 16938639
Hmm problem is I need to parse out different controls , heres part of the code I'm using









        For Each elm In all
            strName = elm.getAttribute("NAME")
            strId = elm.id
            strvalue = elm.innerText
            strType = elm.getAttribute("type")


Anyway to convert my string to wokr with that?
0
 
LVL 1

Author Comment

by:JPERKS1985
ID: 16939792
nevermind I got it working thanks.
0
 
LVL 1

Author Comment

by:JPERKS1985
ID: 16939961
Now is there a way to use this source to pass cookies? Also is there a way for proxy support? Thats why I was using httprequest
0
 
LVL 1

Author Comment

by:JPERKS1985
ID: 16940101
Better yet, how do I extract the cookies and route the request for the page through a proxy?
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question