Sample code for 30+ languages & platforms
C#

Example: Http.HttpNoBody method

Demonstrates how to use the HttpNoBody method to send HTTP requests without a request body (e.g., GET, DELETE, HEAD) and receive the response in a Chilkat Http response object.

Chilkat C# Downloads

C#
bool success = false;

Chilkat.Http http = new Chilkat.Http();
Chilkat.HttpResponse resp = new Chilkat.HttpResponse();

//  Send a DELETE request to https://api.example.com/users/123
string url = "https://api.example.com/users/123";
success = http.HttpNoBody("DELETE",url,resp);
if (success == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

Debug.WriteLine("Response Status Code: " + Convert.ToString(resp.StatusCode));
Debug.WriteLine("Response body:");
Debug.WriteLine(resp.BodyStr);