简体   繁体   中英

How to change from a HTTP POST request to HTTPS POST request?

I right now have an HTTP POST request using this layout:

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();

I want to set a password(textbox) on a website using a POST request with C#. I tried with the above layout, but it doesn't set it. So I think it's because I'm using an HTTP request instead of an HTTPS request(Do you think I'm right?). My problem is, I don't know how to send it as an HTTPS request. I need a way to make it HTTPS.

I should probably clarify that I'm sending the following things:

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

So I guess the website does process my request but doesn't care about some things in it. Maybe it's the cookies?

Thank you in advance.

显然,该网站确实处理并收到了我寄给他的东西,但它从未将它们寄回给我,因为安全。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM