'/ sms'应用程序中的服务器错误。 指定值没有':'分隔符。 参数名称: header 描述:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。 异常详细信息:System.ArgumentException:指定的值没有':'分隔符。 参数名称:header 来源错误: 第33行:string postData =usr = yourapi username & pwd = yourapipwd& from =+ txtFrom.Text +& to =+ txtTo.Text +& type = text+ txtBody.Text; 第34行: 第35行:webClient.Headers.Add(Content-Type,application / x-www-form-urlencoded); 第36行: 第37行:lblResult.Text = webClient.UploadString(http://api.myvaluefirst.com/psms/servlet/psms.Eservice2?data=<?xml%20version=\1.0 \% 20encoding = \ ISO-8859-1\ >?<!DOCTYPE%20MESSAGE%20SYSTEM%20\ http://127.0.0.1/psms/dtd/message.dtd\ %20 - ; < message>< user%20username> 源文件:d:\ Mohanraj \ Mohanraj \日常练习\ sms \SMS.aspx.cs行:35 Stack Tr ace: [ArgumentException:指定的值没有':'分隔符。 参数名称:header] System.Net.WebHeaderCollection.Add(String header)+1881748 SMS.btnSend_Click(Object sender,EventArgs e)在d:\ Mohanraj \ Mohanraj \日常练习\ sms \SMS.aspx.cs:35 System.Web.UI.WebControls.Button.OnClick(EventArgs e)+118 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)+112 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)+10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,String eventArgument)+13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)+36 System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+5563 版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.1 使用系统; 使用 System.Collections.Generic; 使用 System.Linq; 使用 System.Web; 使用 System.Web.UI; 使用 System.Web.UI.WebControls; 使用 System.Web.UI.WebControls.WebParts; 使用 System.Web.UI.HtmlControls; 使用 System.IO; 使用 System.Net; 使用 System.Text; public partial 类 SMS:System.Web.UI.Page { protected void Page_Load( object sender,EventArgs e) { } protected void btnSend_Click( object sender,EventArgs e) { System.Net.WebClient webClient = new System.Net.WebClient(); string postData = usr = yourapi username& pwd = yourapipwd& from = + txtFrom.Text + & to = + txtTo.Text + & type = text + txtBody.Text ; webClient.Headers.Add( Content-Type, application / x-www-form-urlencoded); lblResult.Text = webClient.UploadString( http://api.myvaluefirst.com /psms/servlet/psms.Eservice2?data=&lt;?xml%20version=\\"1.0\\"%20encoding=\\"ISO-8859-1\\"?><!DOCTYPE%20MESSAGE %20SYSTEM%20 \http://127.0.0.1/psms/dtd/message.dtd\%20>< MESSAGE>< USER%20USERNAME = \您的SMS API用户名 + \%20PASSWORD = \您的SMS API密码 + \/>< SMS%20UDH = \0 \%20CODING = \1 \% 20TEXT = \ + txtBody.Text + \%20PROPERTY = \0 \%20ID = \1 \>< ADDRESS%20FROM = \919903013543 \%20TO = \ + txtTo.Text + \%20SEQ = \1 \%20TAG = \some%20clientside%20random%20data \%20 />< / SMS>< / MESSAGE>& action = send,postData); } } 解决方案 您需要修改附近的双qutos 您的SMS API用户名 和 Content-Type,application / x-www-form-urlencoded 使用系统; 使用 System.Collections.Generic; 使用 System.Linq; 使用 System.Web; 使用 System.Web.UI; 使用 System.Web.UI.WebControls; 使用 System.Web.UI.WebControls.WebParts; 使用 System.Web.UI.HtmlControls; 使用 System.IO; 使用 System.Net; 使用 System.Text; public partial class SMS:System.Web.UI.Page { protected void Page_Load( object sender,EventArgs e) { } protected void btnSend_Click( object sender,EventArgs e) { System.Net.WebClient webClient = new System.Net.WebClient(); string postData = usr = yourapi username& pwd = yourapipwd& from = + txtFrom.Text + & to = + txtTo.Text + & type = text + txtBody.Text ; webClient.Headers.Add( Content-Type, application / x-www-form-urlencoded); lblResult.Text = webClient.UploadString( http://api.myvaluefirst.com /psms/servlet/psms.Eservice2?data=<?xml%20version=\\"1.0\\"%20encoding=\\"ISO-8859-1\\"?><user%20username>} } Server Error in '/sms' Application.Specified value does not have a ':' separator.Parameter name: headerDescription: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.ArgumentException: Specified value does not have a ':' separator.Parameter name: headerSource Error:Line 33: string postData = "usr=yourapi username & pwd=yourapipwd&from= " + txtFrom.Text + "&to=" + txtTo.Text +"&type=text" + txtBody.Text;Line 34:Line 35: webClient.Headers.Add("Content-Type","application/x-www-form-urlencoded");Line 36:Line 37: lblResult.Text = webClient.UploadString("http://api.myvaluefirst.com/psms/servlet/psms.Eservice2?data=<?xml%20version=\"1.0\"%20encoding=\"ISO-8859-1\"?><!DOCTYPE%20MESSAGE%20SYSTEM%20\"http://127.0.0.1/psms/dtd/message.dtd\"%20><message><user%20username>Source File: d:\Mohanraj\Mohanraj\Daily practice\sms\SMS.aspx.cs Line: 35Stack Trace:[ArgumentException: Specified value does not have a ':' separator.Parameter name: header] System.Net.WebHeaderCollection.Add(String header) +1881748 SMS.btnSend_Click(Object sender, EventArgs e) in d:\Mohanraj\Mohanraj\Daily practice\sms\SMS.aspx.cs:35 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.IO;using System.Net;using System.Text;public partial class SMS : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { } protected void btnSend_Click(object sender, EventArgs e) { System.Net.WebClient webClient = new System.Net.WebClient();string postData = "usr=yourapi username & pwd=yourapipwd&from= " + txtFrom.Text + "&to=" + txtTo.Text +"&type=text" + txtBody.Text;webClient.Headers.Add("Content-Type","application/x-www-form-urlencoded");lblResult.Text = webClient.UploadString("http://api.myvaluefirst.com/psms/servlet/psms.Eservice2?data=&lt;?xml%20version=\"1.0\"%20encoding=\"ISO-8859-1\"?><!DOCTYPE%20MESSAGE%20SYSTEM%20\"http://127.0.0.1/psms/dtd/message.dtd\"%20><MESSAGE><USER%20USERNAME=\"Your SMS API Username" + "\"%20PASSWORD=\"Your SMS API Password" + "\"/><SMS%20UDH=\"0\"%20CODING=\"1\"%20TEXT=\"" + txtBody.Text + "\"%20PROPERTY=\"0\"%20ID=\"1\"><ADDRESS%20FROM=\"919903013543\"%20TO=\"" + txtTo.Text + "\"%20SEQ=\"1\"%20TAG=\"some%20clientside%20random%20data\"%20/></SMS></MESSAGE>&action=send", postData); }} 解决方案 Hi,You need to modify Double qutos near"Your SMS API Username"and"Content-Type","application/x-www-form-urlencoded"using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.IO;using System.Net;using System.Text;public partial class SMS : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { } protected void btnSend_Click(object sender, EventArgs e) { System.Net.WebClient webClient = new System.Net.WebClient();string postData = "usr=yourapi username & pwd=yourapipwd&from= " + txtFrom.Text + "&to=" + txtTo.Text +"&type=text" + txtBody.Text;webClient.Headers.Add("Content-Type","application/x-www-form-urlencoded");lblResult.Text = webClient.UploadString("http://api.myvaluefirst.com/psms/servlet/psms.Eservice2?data=<?xml%20version=\"1.0\"%20encoding=\"ISO-8859-1\"?><user%20username> }} 这篇关于我有这个错误,我不知道如何纠正这个错误,帮助我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 21:14