.Net中WebClient的使用

 

Code
WebClient aWb = new WebClient()
//定义一个键值列
System.Collections.Specialized.NameValueCollection Data
= new System.Collections.Specialized.NameValueCollection();
Data[
"uid"] = HjDict.Bulo_ID.ToString();
Data[
"w"] = word;
Data[
"c"] = comment;
Data[
"type"] = type;
Data[
"from"] = HttpContext.Current.Server.UrlDecode(referurl);
Data[
"langs"] = langs;
//将键值列提交到指定页面,已“Post”方式,并获取返回值
byte[] aBytes = aWb.UploadValues("http://" + HjDict.MyDictUrl + "/dict/mydict_new.aspx", "post", Data);
//将返回值编码
retstring
= aWb.Encoding.GetString(aBytes);

 

posted @ 2008-09-28 16:30  宿远  阅读(380)  评论(0编辑  收藏  举报