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.

0

About the author

Janaki(http://mjanaki.com) - 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

Comments are closed.