TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sarwar Hussain
NA
423
333.4k
HttpClient Post request arise an error?
Apr 21 2015 3:44 AM
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<KeyValuePair<string, string>>
{
new KeyValuePair<string, string>("ticketId",tb_TicketNo.Text),
new KeyValuePair<string, string>("status","test"),
new KeyValuePair<string, string>("responseTime","test"),
new KeyValuePair<string, string>("clouserComment","test"),
new KeyValuePair<string, string>("date_time","test"),
new KeyValuePair<string, string>("lat","test"),
new KeyValuePair<string, string>("longitude","test"),
new KeyValuePair<string, string>("barcode","test"),
new KeyValuePair<string, string>("CustName","test"),
new KeyValuePair<string, string>("CustDesignation","test"),
new KeyValuePair<string, string>("user_id","test"),
new KeyValuePair<string, string>("remark","test"),
new KeyValuePair<string, string>("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'."
Reply
Answers (
2
)
send message to a mobile on button click
How to add textbox in applicationbar in windows phone 8