Click here to Skip to main content
15,030,320 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I tried this code and getting the exception like this


{"message":"Invalid Mashape Key"}
An exception of type System.Exception occurred in ASPSnippets.SmsAPI.dll but was not handled in user code

What I have tried:

public void sent()

{
bool isSent = SendOTPSMS("&&&&&&****", "*****", "NHa1bjKulkmshpU91Xel3gj94SDKp18z3qcjsnCuDyxq7OOePV", "++++++@@@@", "OTP: 324353");
}
public static bool SendOTPSMS(string senderMobileNo, string senderPassword, string MshapeKey, string receiverMobileNo, string Message)
{
bool isSent = true;
try
{
WebRequest request = WebRequest.Create("https://site2sms.p.mashape.com/index.php?msg="
+ Message + "&phone=" + receiverMobileNo + "&pwd=" + senderPassword + "&uid=" + senderMobileNo);
request.Headers.Add("X-Mashape-Key", MshapeKey);
WebResponse response = request.GetResponse();
return isSent;
}
catch (Exception ex)
{
return false;
}
}
Posted
Updated 21-Sep-16 23:46pm
Comments
Vjay Y 22-Sep-16 5:02am
   
from the exception mshapekey is seems to be invalid. can you try with another one
Member 12675499 22-Sep-16 5:46am
   
I tried with valid mshapekey but same exception getting.Please give one more solution.

1 solution

The error is pretty self-explanatory, you are giving it an invalid key. Contact the software vendor and find out what the key is supposed to be, we can't tell you that.
   
Comments
Member 12675499 24-Sep-16 6:29am
   
But how to contact the software vendor for the Mashape key.
F-ES Sitecore 26-Sep-16 4:08am
   
I imagine you'll need to contact site2sms, as mashape is a third-party api key manager that they will use.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900