1. Import the certificate into your PC
2. Obtaining a Certificate
[CSharp]View PlainCopyprint?
- Private static X509Certificate2 getsentosacertificate ()
- {
- X509store Usercastore = new X509store (storename.my, storelocation.localmachine);
- Try
- {
- Usercastore.open (openflags.readonly);
- X509Certificate2Collection Certificatesinstore = usercastore.certificates;
- X509Certificate2Collection Findresult = Certificatesinstore.find (X509findtype.findbysubjectname, "*. Sentosa.com.sg ", true);
- X509Certificate2 clientcertificate = null;
- if (Findresult.count = = 1)
- {
- ClientCertificate = findresult[0];
- }
- Else
- {
- throw New Exception ("Unable to locate the correct client certificate.");
- }
- return clientcertificate;
- }
- Catch
- {
- throw;
- }
- finally
- {
- Usercastore.close ();
- }
- }
3. Attach the certificate to the HTTP request
http://www.woaipu.com/shops/zuzhuan/61406
Http://www.znds.com/tv-967956-1-1.html
Http://www.znds.com/tv-967958-1-1.html
C # HTTPS Client tool methods for obtaining certificates