我正在开发 ASP.NET 4.0 Web 应用程序,我想从 X509Store 读取当前用户证书。读取 LocalMachine 证书工作正常,但如果我将 StoreLocation 设置为 CurrentUser,它会给我一个空集合。
以下代码工作正常:
X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine); // StoreLocation.CurrentUser
store.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
我检查了我的个人商店(通过 certmgr.mmc),我确定我有证书。
我错过了什么?( store.Certificates 为空)