Elad Gutman Elad Gutman - 4 months ago 82
C# Question

Sending HTTPS request in C#

I used Fiddler to monitor trafic to a specific host (I checked the 'Decrypt HTTPS trafic' option), and this is the HTTP request that was sent:

POST https://host.something/index.php HTTP/1.1 Host: host.something
Connection: keep-alive Content-Length: 17 Cache-Control: max-age=0
Origin: https://host.something Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71
Safari/537.36 Content-Type: application/x-www-form-urlencoded Accept:
Referer: https://host.something/index.php Accept-Encoding: gzip,
deflate, br Accept-Language: en-GB,en-US;q=0.8,en;q=0.6


My question is - can I use C# code to send the same request? Can I do it using WebRequest or WebClient classes? Is there any problem to sent HTTPS request using C# code?

A code example would be very helpful...

Thank you all,




It is possible to set Standard and Custom Header Information.