wp8 入门到精通 WebClient Post

WebClient wc = new WebClient();

var URI = new Uri("http://your_uri_goes_here");

//If any encoding is needed.

wc.Headers["Content-Type"] = "application/x-www-form-urlencoded";

//Or any other encoding type.

//If any key needed

wc.Headers["KEY"] = "Your_Key_Goes_Here";

wc.UploadStringCompleted += new UploadStringCompletedEventHandler(wc_UploadStringCompleted);

wc.UploadStringAsync(URI, "POST", "Data_To_Be_sent");

 

void wc_UploadStringCompleted(object sender, UploadStringCompletedEventArgs e)
{

try
{
MessageBox.Show(e.Result);
//e.result fetches you the response against your POST request.

}

catch (Exception exc)
{
MessageBox.Show(exc.ToString());
}

}

wp8 入门到精通 WebClient Post,布布扣,bubuko.com

wp8 入门到精通 WebClient Post

上一篇:安全的PHP代码编写准则


下一篇:sql的演示