Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing Web content thru basic authentication
Message
From
05/01/2005 03:03:37
 
 
To
05/01/2005 02:36:21
General information
Forum:
ASP.NET
Category:
Web control library
Miscellaneous
Thread ID:
00974293
Message ID:
00974295
Views:
28
I simply added the credentials line and that did it:
    ' Get the HTML response from a server for a basic authentication
    Public Shared Function GetUrlBasicAuthentication(ByVal tcUrl As String, ByVal tcUsername As String, ByVal tcPassword As String) As String
        Dim lcHTML As String
        Dim lcUrl As New System.Uri(tcUrl)
        Dim loHTTP As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(lcUrl)
        loHTTP.Credentials = New System.Net.NetworkCredential(tcUsername, tcPassword)
        lError = False
        cError = ""
        Try
            Dim loWebResponse As System.Net.WebResponse = loHTTP.GetResponse()
            Dim loStream As System.IO.Stream = loWebResponse.GetResponseStream()
            Dim loString As New System.IO.StreamReader(loStream)
            lcHTML = loString.ReadToEnd()
        Catch loError As Exception
            cError = loError.Message
            lError = True
            lcHTML = loError.Message
        End Try
        Return lcHTML
    End Function
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform