I am getting an error on this line.
X509Certificate2 cert = new X509Certificate2(fileName.pfx, password, X509KeyStorageFlags.PersistKeySet);
*System.Security.Cryptography.CryptographicException: The specified network password is not correct*
The above code works in my local windows 10, but not on the Windows server 2012..
I have tried the following resolution that worked for others.
Tried with different X509KeyStorageFlags properties.
changed code to get the certificate from store instead of the file.
Also, What is the correct way to generate the pfx file?