点消息在SMS源地址中消失

问题描述 投票:1回答:1

我正在从我的Web应用程序发送一个SMS,它是用ASP.NET C#构建的,但出于某些原因,当我添加SourceAddressparameter.Add("SourceAddress", "BPD.co.uk");时,工作的BPD.co.uk来自BPDcouk

我怎样才能出现积分?

继承我的C#代码:

public void SendSms(string MobileNumber, string SMSContent)
{
    Dictionary<string, string> parameter = new Dictionary<string, string>();

    parameter.Add("Action", "Send");
    parameter.Add("DestinationAddress", MobileNumber);
    parameter.Add("SourceAddress", "BPD.co.uk");
    parameter.Add("Body", SMSContent);
    parameter.Add("ValidityPeriod", "86400");
    string resultcode = api_connect("nsp04456", "pword", parameter);
}

这是对API Connect的调用

private string api_connect(string Username, string Password, Dictionary<string, string> ParametersDict)
{
    string url = "http://api.sms.co.uk/api/api.php";
    string poststring = "Username=" + Username + "&";
    poststring = poststring + "Password=" + Password;
    // Turn the parameter dictionary object into the variables
    foreach (KeyValuePair<string, string> item in ParametersDict)
    {
        poststring = poststring + "&" + item.Key + "=" + item.Value;
    }

    MSXML2.ServerXMLHTTP60 xmlHttp = new MSXML2.ServerXMLHTTP60();// Server.CreateObject("MSXML2.ServerXMLHTTP.4.0");
    xmlHttp.open("POST", url, false);
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.send(poststring);

    return xmlHttp.responseText;

}
c# asp.net xmlhttprequest serverxmlhttp
1个回答
0
投票

我猜你正在使用的API是清理你的参数并删除它认为不应该存在的东西。您可以尝试转义参数的值并添加BPD \ .co \ .uk等斜线,看看会发生什么

© www.soinside.com 2019 - 2024. All rights reserved.