Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ssl/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何从HTTP POST请求更改为HTTPS POST请求?_C#_Ssl_Https_Httpclient - Fatal编程技术网

C# 如何从HTTP POST请求更改为HTTPS POST请求?

C# 如何从HTTP POST请求更改为HTTPS POST请求?,c#,ssl,https,httpclient,C#,Ssl,Https,Httpclient,我现在有一个HTTP POST请求,它使用以下布局: private static readonly HttpClient client = new HttpClient(); var values = new Dictionary<string, string> { { "thing1", "hello" }, { "thing2", "world" } }; var content = new FormUrlEncodedContent(values); var

我现在有一个HTTP POST请求,它使用以下布局:

private static readonly HttpClient client = new HttpClient();

var values = new Dictionary<string, string>
{
   { "thing1", "hello" },
   { "thing2", "world" }
};

var content = new FormUrlEncodedContent(values);

var response = await client.PostAsync("https://www.example.com/recepticle.aspx", content); //It's not the URL I'm using.

var responseString = await response.Content.ReadAsStringAsync();
所以我猜网站确实处理了我的请求,但并不关心其中的一些事情。也许是饼干


提前谢谢。

很明显,网站确实处理并收到了我发给他的东西,但由于安全原因,它从未将它们发回给我

只需在
http
之后添加一个
s
,HttpClient将处理其余部分。@WashingtonA.Ramos很抱歉,我使用的URL确实以HTTPS开头,我在代码中提到过它。仍然不起作用。响应的状态代码和响应内容是什么?这不太可能与HTTPS有关。如果您试图发布到WebForms页面(假设来自.aspx),则需要包含有效的_VIEWSTATE和_EVENTVALIDATION值,这些值通常从GET获取。还可能需要CSRF令牌。然后,您需要将回发的控制源设置为正常登录按钮的正确唯一标识符,并将用户名和密码作为用户名和密码文本框的唯一标识符的值发送。这是否回答了您的问题?
Password, - Not in the textbox
Password again, - Not in the textbox 
question index, - In the textbox
answer for the question, - In the textbox
terms_of_service. - Not in the textbox