Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting the content of a URL
Message
From
01/10/2006 18:24:44
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Getting the content of a URL
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01158458
Message ID:
01158458
Views:
57
I have this code to get the content of a URL:
        ' Get the HTML response from a server
        ' expC1 Url
        Public Function GetUrl(ByVal tcUrl As String) As String
            Dim lcHTML As String
            Dim loHTTP As System.Net.WebClient = New System.Net.WebClient
            Dim loEncoding As System.Text.Encoding = New System.Text.ASCIIEncoding
            Dim loRequestedHTML() As Byte
            Try
                loRequestedHTML = loHTTP.DownloadData(tcUrl)
                lcHTML = loEncoding.GetString(loRequestedHTML)
            Catch loError As Exception
                lcHTML = loError.Message
            End Try
            Return lcHTML
        End Function
I am wondering about the declaration of the loEncoding. I put ASCIIEncoding for now. But, when getting the content of a URL, is that the proper encoding to use?
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
Next
Reply
Map
View

Click here to load this message in the networking platform