C#
C#
Example: Http.QuickGetStr method
Demonstrates theQuickGetStr method.
Chilkat C# Downloads
Chilkat.Http http = new Chilkat.Http();
// Keep the response body if there's an error.
http.KeepResponseBody = true;
// Send the HTTP GET and return the content in a string.
string str = http.QuickGetStr("https://www.chilkatsoft.com/helloWorld.json");
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(http.LastResponseBody);
}
return;
}
Debug.WriteLine(str);
Debug.WriteLine("Success");