I have used a MVC web application running on the ASP.NET Framework version 4.5.1
.
I have made nopcommercePlugin
. I am upgrading version 3.4 to 3.5
After the update, I am getting the following error:
System.TypeLoadException: Could not load type
'RestSharp.HttpBasicAuthenticator' from assembly 'RestSharp,
Version=105.2.1.0, Culture=neutral, PublicKeyToken=null'.
I am using Twilio
to send an SMS message:
using Twilio;
public bool MethodName(string FromNumber, string ToNumber, string URL, string code = "")
{
if (code == "")
{
//URL = URL.Replace(" ", "%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20");
URL = URL.Replace(" ", "%20");
}
else
{
URL = URL + code + " we repeat your code is : " + code;
URL = URL.Replace(" ", "%20");
}
string AccountSid = _SMSProviderSettings.SMSGatewayTwillioAccountSID;
string AuthToken = _SMSProviderSettings.SMSGatewayTwillioAccountAuthToken;
var twilio = new TwilioRestClient(AccountSid, AuthToken);
var options = new CallOptions();
var twimal = new Twilio.TwiML.TwilioResponse();
twimal.Pause(5);
options.To = ToNumber;
options.Url = URL;
options.From = FromNumber;
options.Method = "GET";
var call = twilio.InitiateOutboundCall(options);
if (call != null)
{
if (call.RestException == null)
return true;
}
//error log entry in system log
_logger.InsertLog(LogLevel.Error, call.RestException.Message, call.RestException.Message + " For more detail click here " + call.RestException.MoreInfo);
return false;
}
The Installed version are :
I have seen a similar question posted back in 18th August 2015 (8 days ago) and there is also some discussion on the Twilio Nuget
page discussing an Alpha Version that is reported.
If I used RestShrap 105.2.2 version then These errors are generate
Can anyone tell me what version options should be used?
Twilio developer evangelist here.
RestSharp has been updated last week to version 105.2.2. that caused the Twilio library to start failing since HttpBasicAuthenticator has been moved around to a different namespace.
The Twilio Library has then been updated to version 4.0.5 which now works with RestSharp version 105.2.2. The packages file has also been updated to use that version.
So in short, all you should need to do is update your RestSharp to version 105.2.2 via Nuget Package Manager or via Package Manager Console by running:
Install-Package RestSharp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With