(C#) Transition from Http.PostBinary to Http.HttpBinary
Provides instructions for replacing deprecated PostBinary method calls with HttpBinary. Note: This example requires Chilkat v11.0.0 or greater.
bool success = false;
Chilkat.Http http = new Chilkat.Http();
string verb = "POST";
string url = "https://example.com/";
byte[] byteData = null;
string contentType = "application/octet-stream";
// ------------------------------------------------------------------------
// The PostBinary method is deprecated:
string responseBody = http.PostBinary(url,byteData,contentType,false,false);
if (http.LastMethodSuccess == false) {
Debug.WriteLine(http.LastErrorText);
return;
}
// ...
// ...
// ------------------------------------------------------------------------
// Do the equivalent using HttpBinary.
Chilkat.HttpResponse responseOut = new Chilkat.HttpResponse();
success = http.HttpBinary(verb,url,byteData,contentType,responseOut);
if (success == false) {
Debug.WriteLine(http.LastErrorText);
return;
}
responseBody = responseOut.BodyStr;
|