gpt4 book ai didi

c# - 名称 'X509Certificate2UI' 在当前上下文中不存在

转载 作者:可可西里 更新时间:2023-11-01 03:05:17 25 4
gpt4 key购买 nike

有人在 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 中组装。

关于c# - 名称 'X509Certificate2UI' 在当前上下文中不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15617409/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com