Home » c# » c# – How to change from a HTTP POST request to HTTPS POST request?-Exceptionshub

c# – How to change from a HTTP POST request to HTTPS POST request?-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

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.

How to&Answers:

Apperantly the website did process and got the things I sent him but it never sent them back to me, because security.