I am trying to programmatically install a certificate in IIS. The solutions I have found are similar to this: Install SSL Certificate programatically using Microsoft.Web.Administration. Basically it says to do something like this:
var store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
var certificate= new x509certificate2(certFilePath);
store.add(certificate);
However, this adds the certificate to the users personal certificate store. What I am trying to do is add it to IIS Server Certificates. The user would use IIS to create a certificate request, send it to a CA to get a .cer file, then my tool would take that file and complete the certificate request, storing the certificate in IIS.
Is there a way to use Microsoft.Web.Administration
to do this?