Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does twilio-csharp work in Mono?

Tags:

c#

mono

twilio

Hello I've recently been messing around with Twilio and their official twilio-csharp library. I'm using it on mono 2.10.5(x86-64) on Linux and I'm having problems getting a basic example working.

My code:

var twilio = new TwilioRestClient("[accountsid]", "[authkey]");
var msg = twilio.SendSmsMessage("+1316313XXXX, "+1918917XXXX", "I'm a monkey Mr. Anderson");

Seems to be very simple but when running it, the msg object returned is null and no message gets sent. Is this something I'm doing wrong or does the library not work in Mono?

like image 338
Earlz Avatar asked Apr 29 '26 06:04

Earlz


1 Answers

The problem is detailed in this page: http://www.mono-project.com/UsingTrustedRootsRespectfully

Basically, Mono doesn't ship with any root certificate authorities. So, the quick and dirty fix is to trust all certificates:

ServicePointManager.ServerCertificateValidationCallback = 
                delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) 
                    { return true; };

It's not very secure, but depending on your uses, it may not matter.

like image 86
Earlz Avatar answered Apr 30 '26 19:04

Earlz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!