Get HTML Source Code

Omny

New member
Joined
Jan 7, 2005
Messages
1
Programming Experience
Beginner
Hello,

I am trying to convert an application from VB 6.0 to VB .Net and ran into a problem. I have a function that uses MSXML. My .Net application now requires a DLL file in order for it to work. I would like my program to be self contained within the executable. Can someone assist me in converting the following function to VB .Net?

--
Public Function GetPageHTML(ByVal URL As String) As String
Dim HttpReq As New MSXML2.XMLHTTP30
Try
HttpReq.open("GET", URL, False)
HttpReq.send()
GetPageHTML = HttpReq.responseText()
HttpReq =
Nothing
Catch ex As Exception
Return ex.Message
End Try
End Function
--

What I'm using the function for is to grab the HTML from a work intranet page (an https:// page). The webpage is a large table displaying numeric values. It's all generated from coldfusion. I believe the webpage uses windows authentication. When you load the page into a browser, you are given a pop-up asking for a login/password; then it doesn't ask again unless you close the browser.

The code above duplicated this as my program, upon first being launched, forces the pop-up box. After that, the pop-up box never comes up again unless the program is closed and re-launched. My program parses the HTML displaying only a few of the values from the webpage. It will auto-update every 5 minutes or you can force an update by clicking on the "update" button.

I have tried using system.net.webrequest but I receive a (401)Unauthorized exception error when I use the .getresponse. (I'm even trying with credentials but I'm probably doing it wrong). I would prefer the windows authentication pop-up box to come up so users can just sign into that but I will code a login page on my form if I have to hard code the login/password.

Any help is greatly appreciated.

Thanks,
Omny
 
Top Bottom