How to send HTTPS Post Request with C#

Please follow the below steps to send https post request.

  • Create new C# website application.
  • Open the default code behind file i.e. Default.aspx.cs
  • add the following two namespace
    using System.Security.Cryptography.X509Certificates;
    using System.Net;
For the https request we have to create a CertificatePolicy  subclass which is
Now go to the page load event and paste the following code.

If you want to convert the response test to xml, then
  • add the xml namespace as  using System.Xml;
  • then add the following code below the responseText as

Now you can use this xml result according to your requirement.


About the author

Janaki( - A Software developer with 9+ years of experience in multiple technology projects across web, mobile, and cloud applications with expertise in PHP, C#, MySQL, Web services and open source platforms.

Similar Posts

Sample nginx vhsot config file
Uninstall MySql on a Mac OS X
VMWare shared folder as apache vhost

Leave a reply


Eye Test: * Time limit is exhausted. Please reload CAPTCHA.