Click here to Skip to main content
16,016,227 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
Hi,

this is my code to create ssl certificate

ProcessStartInfo info = new ProcessStartInfo();
Process p = new Process();
info.FileName = Server.MapPath(@"~\Bin\makecert.exe");
info.UseShellExecute = false;
info.Verb = "runas"; // Provides Run as Administrator
info.Arguments = @" -n " + @"""CN=ExampleSSL""" + @" -b 12/10/2013 -e 01/05/2014 -r -sky exchange -pe -sr localMachine -ss my -sp " + @"""Microsoft RSA SChannel Cryptographic Provider""" + @" -sy 12 -sv example.pvk";
p.StartInfo = info;
p.Start();

in this no exception is raising at the same time no certificate is created.

Please check my code where I did mistake

thanks
purna
Posted

1 solution

Try to call this fucntion where you need to display SSL Certificate

public void SSLCErtificate()
{

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(adrBarTextBox.Text);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
response.Close();

//retrieve the ssl cert and assign it to an X509Certificate object
X509Certificate cert = request.ServicePoint.Certificate;

//convert the X509Certificate to an X509Certificate2 object by passing it into the constructor
X509Certificate2 cert2 = new X509Certificate2(cert);

//display the cert dialog box
X509Certificate2UI.DisplayCertificate(cert2);
}

Thanking you
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900