有人在 Asp Net MVC4 应用程序中使用 X509Certificate2UI 类时遇到问题吗
using System.Security.Cryptography.X509Certificates;
private static X509Certificate2 PickCertificate(StoreLocation location, StoreName name)
{
try
{
store.Open(OpenFlags.ReadOnly);
//PROBLEM IS HERE
X509Certificate2 cert = X509Certificate2UI.SelectFromCollection(store.Certificates, "Caption", "Message", X509SelectionFlag.SingleSelection)[0];
}
catch (Exception)
{
throw;
}
}
它抱怨当前上下文中没有“X509Certificate2UI”名称
不知道,因为该类位于 System.Security.Cryptography.X509Certificates 中;
您需要包含以下参考:System.Security.dll
进入你的项目,因为它
不包含在mscorlib
大会,但在System.Security
集会。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)