C#怎么用post传值。然后在webrowers里显示提交后的网页啊求大神帮助

 我来答
1月饼57454谑城
2014-08-16 · 超过70用户采纳过TA的回答
知道答主
回答量:139
采纳率:100%
帮助的人:65.6万
展开全部
这段代码你试试: Encoding encoding = Encoding.GetEncoding( "GB2312 "); string strUrl = @ "http:// " + DefaultIP + " " + DefaultUrl + " "; string postData = "username= "+UserName+ "&password= "+password+ "&area_c=&telfile1= "+TelePhones+ " "; byte[] data = encoding.GetBytes(postData); // 准备HTTP请求... System.Net.HttpWebRequest myRequest = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(strUrl); myRequest.Method = "POST "; myRequest.ContentType = "application/x-www-form-urlencoded "; myRequest.ContentLength = data.Length; System.IO.Stream newStream = myRequest.GetRequestStream(); // 发送数据 newStream.Write(data, 0, data.Length); newStream.Close(); //HTTP响应 System.Net.HttpWebResponse myResponse = (System.Net.HttpWebResponse)myRequest.GetResponse(); System.IO.Stream receiveStream = myResponse.GetResponseStream(); Encoding encode = System.Text.Encoding.GetEncoding( "GB2312 "); System.IO.StreamReader readStream = new System.IO.StreamReader(receiveStream, encode); Char[] read = new Char[256]; int count = readStream.Read(read, 0, 256); StringBuilder sb = new StringBuilder( " "); while (count > 0) { String readstr = new String(read, 0, count); sb.Append(readstr); count = readStream.Read(read, 0, 256); } myResponse.Close(); readStream.Close();
噗哧哧2pU釉
2014-08-16 · 超过55用户采纳过TA的回答
知道答主
回答量:111
采纳率:0%
帮助的人:142万
展开全部
网址?参数=数值
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式