公告
财富商城
积分规则
提问
发文
2019-01-21 09:00发布
Fickle 薄情
Related: how-do-i-use-webrequest-to-access-an-ssl-encrypted-site-using-https
How to send an HTTPS GET Request in C#?
Add ?var1=data1&var2=data2 to the end of url to submit values to the page via GET:
?var1=data1&var2=data2
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();
Simple Get Request using HttpClient Class
using System.Net.Http; class Program { static void Main(string[] args) { HttpClient httpClient = new HttpClient(); var result = httpClient.GetAsync("https://www.google.com").Result; } }
I prefer to use WebClient, it seems to handle SSL transparently:
http://msdn.microsoft.com/en-us/library/system.net.webclient.aspx
Some troubleshooting help here:
http://clipperhouse.com/blog/post/WebClient-Fiddler-and-SSL.aspx
最多设置5个标签!
Add
?var1=data1&var2=data2
to the end of url to submit values to the page via GET:Simple Get Request using HttpClient Class
I prefer to use WebClient, it seems to handle SSL transparently:
http://msdn.microsoft.com/en-us/library/system.net.webclient.aspx
Some troubleshooting help here:
http://clipperhouse.com/blog/post/WebClient-Fiddler-and-SSL.aspx