7 Replies Latest reply: Sep 19, 2018 11:42 AM by Adam Westhusing RSS

    How to Upload app using C# System.Net.WebClient

    Øystein Kolsrud

      I'm trying to programmatically upload an app using the WebClient Class (System.Net), but for some reason I get the error "Could not create SSL/TLS secure channel." for that particular call. I have no problem doing a call to UploadString to for instance start a reload so I know I am able to connect and perform posts correctly, but for some reason that post with the app in the body fails. 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.