Click here to Skip to main content
15,889,877 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi guys ,

Just below , I have the code for sending message using attributes of the Post method.

But this codes doesnt work in Windows 8 Metro Apps ,

How is it possible to convert into Windows 8 Metro Apps ?



C#
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);
Posted
Comments
Sergey Alexandrovich Kryukov 9-Nov-13 19:28pm    
"Code does not work" is not informative. How it can possibly depends on the application type? In your code, you don't do anything specific to it. Did you check up the return value under the debugger?
—SA

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