C# 点消失在SMS源地址中
我正在从ASP.NET C#中构建的web应用程序发送短信,但由于某种原因,当我使用C# 点消失在SMS源地址中,c#,asp.net,xmlhttprequest,serverxmlhttp,C#,Asp.net,Xmlhttprequest,Serverxmlhttp,我正在从ASP.NET C#中构建的web应用程序发送短信,但由于某种原因,当我使用参数添加源地址时,添加(“SourceAddress”,“BPD.co.uk”)工作BPD.co.uk作为BPDcouk完成 我怎样才能让这些要点显现出来 这是我的C代码: public void SendSms(字符串MobileNumber,字符串SMSContent) { Dictionary参数=newdictionary(); 参数。添加(“操作”、“发送”); 参数Add(“DestinationAd
参数添加源地址时,添加(“SourceAddress”,“BPD.co.uk”)代码>工作BPD.co.uk
作为BPDcouk
完成
我怎样才能让这些要点显现出来
这是我的C代码:
public void SendSms(字符串MobileNumber,字符串SMSContent)
{
Dictionary参数=newdictionary();
参数。添加(“操作”、“发送”);
参数Add(“DestinationAddress”,MobileNumber);
添加参数(“SourceAddress”,“BPD.co.uk”);
添加参数(“正文”,SMS内容);
添加参数(“ValidityPeriod”、“86400”);
字符串resultcode=api_connect(“nsp04456”,“pword”,参数);
}
下面是对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;
}
private string api\u connect(字符串用户名、字符串密码、字典参数DICT)
{
字符串url=”http://api.sms.co.uk/api/api.php";
string poststring=“Username=“+Username+”&”;
poststring=poststring+“Password=“+Password;
//将参数字典对象转换为变量
foreach(参数DICT中的KeyValuePair项)
{
poststring=poststring+“&”+item.Key+“=”+item.Value;
}
MSXML2.ServerXMLHTTP60 xmlHttp=new MSXML2.ServerXMLHTTP60();//Server.CreateObject(“MSXML2.ServerXMLHTTP.4.0”);
open(“POST”,url,false);
setRequestHeader(“内容类型”,“应用程序/x-www-form-urlencoded”);
send(poststring);
返回xmlHttp.responseText;
}
我猜您使用的API正在清理您的参数并删除它认为不应该存在的内容。您可以尝试转义参数的值,并添加类似BPD\.co\.uk的斜杠,然后查看将“BPD.co.uk”添加到字典中的情况。。。之后会发生什么完全取决于“api_connect”的功能&您调用的特定api在上面添加了api函数。。。。。。那么我应该只做BPD/co/uk还是BPD//co//uk
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;
}