我现在做的是winform程序,想给一个web程序的某个页面传递参数(POST方式),并且打开这个网页。

如题,如何实现?谢谢
2025-01-25 07:16:53
推荐回答(1个)
回答1:

给winform加一个webbrowser控件去
然后用webrequest
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(requestURL);
request.Method = "POST";
UTF8Encoding encoding = new UTF8Encoding();
byte[] data = encoding.GetBytes(PostString);
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
Stream stream = request.GetRequestStream();
得到返回流以后
送给webbrowser的DocumentStream就好