-, .
(!) , IIS . " " "".. , , - IIS .
, Windows, , .
public static X509Certificate2 GetCert()
{
X509Certificate2 cert = FindCertificate(StoreLocation.LocalMachine, StoreName.My, X509FindType.FindBySerialNumber, "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
return cert;
}
static X509Certificate2 FindCertificate(StoreLocation location, StoreName name, X509FindType findType, string findValue)
{
X509Store store = new X509Store(name, location);
try {
store.Open(OpenFlags.ReadOnly);
X509Certificate2Collection col = store.Certificates.Find(findType, findValue, false);
return col[0]; }
finally
{
store.Close();
}
}
, Windows .pfx.
, , , .
: , , , CASE. MMC, , VS UPPER CASE.