如何在C#中发送HTTPS GET请求
相关: 如何使用webrequest访问一个sslencryption站点使用https
如何在C#中发送HTTPS GET请求?
将?var1=data1&var2=data2
到url的末尾以通过GET向页面提交值:
using System.Net; using System.IO; string url = "https://www.example.com/scriptname.php?var1=hello"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream resStream = response.GetResponseStream();
我更喜欢使用WebClient,它似乎透明地处理SSL:
http://msdn.microsoft.com/en-us/library/system.net.webclient.aspx
一些故障排除帮助
http://clipperhouse.com/blog/post/WebClient-Fiddler-and-SSL.aspx