(VB.NET) Example: Http.DownloadSb method
Demonstrates the DownloadSb method.
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
|