2012-04-17 60 views
1

我從我的web應用程序發送一個短信,這是建立在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); 
} 

繼承人

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; 

} 
+0

這會將「BPD.co.uk」添加到字典中......之後會發生什麼取決於「api_connect」的功能以及您調用的具體API – 2012-04-17 10:46:09

+0

添加了API函數 – 2012-04-17 10:48:35

回答

0

我猜調用API_Connect您正在使用的消毒參數,然後去除填充它認爲不應該是API那裏。您可以嘗試轉義您的參數的值並添加斜線,如BPD \ .co \ .uk,然後看看會發生什麼

+0

iv添加了上面的Api函數......所以我應該只做BPD/co/uk或BPD // co // uk – 2012-04-17 10:50:06