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

时间:2020-02-18 20:26:11

标签: 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 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();

我想使用带有C#的POST请求在网站上设置密码(文本框)。我尝试了上述布局,但未设置。所以我认为这是因为我使用的是HTTP请求而不是HTTPS请求(您认为我是对的吗?)。我的问题是,我不知道如何将其作为HTTPS请求发送。我需要一种使其成为HTTPS的方法。

我可能应该澄清我正在发送以下内容:

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

因此,我想该网站确实处理了我的请求,但并不关心其中的某些内容。也许是饼干?

谢谢。

1 个答案:

答案 0 :(得分:0)

很显然,该网站确实进行了处理,并得到了我发给他的东西,但由于安全性,它从未将它们发回给我。

相关问题