I am write a code as bellow for using windows phone :
private void Btn_Submit_Click(object sender, RoutedEventArgs e)
{
string urlPath = "http://192.168.1.84/manageit/servlet/uidServlet";
using (HttpClient hc = new HttpClient(new HttpClientHandler()))
{
var values = new List>
{
new KeyValuePair("ticketId",tb_TicketNo.Text),
new KeyValuePair("status","test"),
new KeyValuePair("responseTime","test"),
new KeyValuePair("clouserComment","test"),
new KeyValuePair("date_time","test"),
new KeyValuePair("lat","test"),
new KeyValuePair("longitude","test"),
new KeyValuePair("barcode","test"),
new KeyValuePair("CustName","test"),
new KeyValuePair("CustDesignation","test"),
new KeyValuePair("user_id","test"),
new KeyValuePair("remark","test"),
new KeyValuePair("observation_date","test")
};
var content = new FormUrlEncodedContent(values);
var response = await hc.PostAsync(urlPath, content);
}
}
But await hc.PostAsync(urlPath, content); Aries an error is
"The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'."

Guest UserPosted Apr 21, 2015, 4:35 AM
Suresh MPosted Apr 21, 2015, 7:46 AM
private async voidBtn_Submit_Click(object sender, RoutedEventArgs e)
{
}