Click here to Skip to main content
16,017,448 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Server Error in '/sms' Application.

Specified value does not have a ':' separator.
Parameter name: header

Description: 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: header

Source 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: 35

Stack 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) +5563

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

C#
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=&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);
    }

}
Posted

1 solution

Hi,

You need to modify Double qutos near

"Your SMS API Username"

and

"Content-Type","application/x-www-form-urlencoded"

C#
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>    }
 
}
 
Share this answer
 

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