1

I have tried this code from their site

using System.Net;
using System.IO;
WebClient client = new WebClient();
// Add a user agent header in case the requested URI contains a query.
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
client.QueryString.Add("user", "xxxx");
client.QueryString.Add("password", "xxxx");
client.QueryString.Add("api_id", "xxxx");
client.QueryString.Add("to", "xxxx");
client.QueryString.Add("text", "This is an example message");
string baseurl = "http://api.clickatell.com/http/sendmsg";
Stream data = client.OpenRead(baseurl);
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
data.Close();
reader.Close();
return s;

I am getting an Proxy authentication failure in

string baseurl ="http://api.clickatell.com/http/sendmsg";

Can anyone help me out??

Marc
  • 3,905
  • 4
  • 21
  • 37
HelloASP
  • 71
  • 1
  • 1
  • 5

1 Answers1

0

I think you are behind a proxy and your web client needs to authenticate. Try the following code:

string userName = "<user name>";
string password = "<password>";
ICredentials creds = new NetworkCredential(userName, password);
client.Credentials = creds;
dan radu
  • 2,772
  • 4
  • 18
  • 23