C#
C#
Example: Http.QuickGetSb method
Demonstrates theQuickGetSb method.
Chilkat C# Downloads
bool success = false;
Chilkat.Http http = new Chilkat.Http();
// Send the HTTP GET and return the content in a StringBuilder
Chilkat.StringBuilder sb = new Chilkat.StringBuilder();
success = http.QuickGetSb("https://www.chilkatsoft.com/helloWorld.json",sb);
if (http.LastMethodSuccess == false) {
if (http.LastStatus == 0) {
// Communications error. We did not get a response.
Debug.WriteLine(http.LastErrorText);
}
else {
Debug.WriteLine("Response status code: " + Convert.ToString(http.LastStatus));
Debug.WriteLine("Response body error text:");
Debug.WriteLine(sb.GetAsString());
}
return;
}
// The downloaded content:
Debug.WriteLine(sb.GetAsString());
Debug.WriteLine("Success");