Sample code for 30+ languages & platforms
VB.NET

Example: Http.DownloadSb method

See more HTTP Examples

Demonstrates the DownloadSb method.

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

Dim http As New Chilkat.Http
http.KeepResponseBody = True

Dim sb As New Chilkat.StringBuilder
success = http.DownloadSb("https://chilkatsoft.com/testData/helloWorld.txt","utf-8",sb)

Dim statusCode As Integer = http.LastStatus
If (success = False) Then
    If (statusCode = 0) Then
        ' Unable to either send the request or get the response.
        Debug.WriteLine(http.LastErrorText)
    Else
        ' We got a response, but the status code was not in the 200s
        Debug.WriteLine("Response status code: " & statusCode)
        ' Examine the response body.
        Debug.WriteLine("Response body:")
        Debug.WriteLine(http.LastResponseBody)
    End If

    Debug.WriteLine("Download failed.")

Else
    Debug.WriteLine("Download success, response status = " & statusCode)
    Debug.WriteLine(sb.GetAsString())
End If