C#
C#
Transition from Http.PTextSb to Http.HttpSb
Provides instructions for replacing deprecated PTextSb method calls with HttpSb.Chilkat C# Downloads
bool success = false;
Chilkat.Http http = new Chilkat.Http();
string verb = "PUT";
string url = "https://example.com/";
Chilkat.StringBuilder sbRequestBody = new Chilkat.StringBuilder();
sbRequestBody.Append("This is the HTTP request body");
string charset = "utf-8";
string contentType = "text/plain";
// ------------------------------------------------------------------------
// The PTextSb method is deprecated:
Chilkat.HttpResponse responseObj = http.PTextSb(verb,url,sbRequestBody,charset,contentType,false,false);
if (http.LastMethodSuccess == false) {
Debug.WriteLine(http.LastErrorText);
return;
}
// ...
// ...
// ------------------------------------------------------------------------
// Do the equivalent using HttpSb.
// Your application creates a new, empty HttpResponse object which is passed
// in the last argument and filled upon success.
Chilkat.HttpResponse responseOut = new Chilkat.HttpResponse();
success = http.HttpSb(verb,url,sbRequestBody,charset,contentType,responseOut);
if (success == false) {
Debug.WriteLine(http.LastErrorText);
return;
}