I am trying to load a digital certificate by putting the certificate on the site. I verified it is there. I then get the path to the cert with the MapPath call, which resolves to file name E:\web\joefrancis1\htdocs\myapp\new-p12-certificate.p12 Server.MapPath("new-p12-certificate.p12"); When I try to load the certicicate with the line of code below... cert = new X509Certificate2(certAndKeyFilename, certAndKeyPassword); ... I get the error "The system cannot find the file specified"
This won't work on the server because this method requires the ASPNET user to load a user profile. Our IIS setup does not load user profile and thus will not work. To work around this, we can install your certificate to the server's machine store and you can modify the code to access the cert from the LocalMachine store See https://support.microsoft.com/en-us/kb/948154