I'm using the System.Net.WebClient class (https://msdn.microsoft.com/en-us/library/system.net.webclient(v=vs.110).aspx) to communicate with a REST API of a server. I'm able to do most operations without problems, but I can't get the "UploadData" method to work (https://msdn.microsoft.com/en-us/library/ms144221(v=vs.110).aspx). When I call that method I get the error "Could not create SSL/TLS secure channel." I have no problem running the corresponding "UploadString" method though. Does anyone have any idea what might be wrong?
To summarize, this method works:
public string Post(string endpoint, string body)
{
return UploadString(new Uri(Uri, endpoint), body);
}
But this fails:
public byte[] Post(string endpoint, byte[] body)
{
return UploadData(new Uri(Uri, endpoint), body);
}
I've been experimenting a lot with different header settings for the resulting request, but haven't been able to make it work. And I'm rather confused that it complains about that SSL/TLS channel problem and don't see how the two calls differs with respect to that.