我已经看到很多关于此的未解决的问题。显然很多开发者已经得到了past这个问题,但我还没有看到任何解决方案发布。请求客户端证书
我正在尝试为我的ASP.NET MVC 5 Web应用程序读取智能卡(X.509 CAC)。当我尝试像这样拉取证书信息时:
var request = HttpContext.Request;
var cert = request.ClientCertificate;
该证书具有空值。
问题似乎是我没有提出请求用户证书信息的对话框,就像我在其他网站上看到的那样。 如何公开此对话框?
我在启用SSL的情况下运行它。我对ApplicationHost.config有这个在它:
<authentication>
<anonymousAuthentication enabled="false"/>
<basicAuthentication enabled="false" />
<clientCertificateMappingAuthentication enabled="false" />
<digestAuthentication enabled="false" />
<iisClientCertificateMappingAuthentication enabled="true" manyToOneCertificateMappingsEnabled="true">
<manyToOneMappings>
<add name="Authentication Certificate"
enabled="true"
permissionMode="Allow"
userName="foo"
password="bar">
<rules>
<add certificateField="Issuer" certificateSubField="CN" matchCriteria="*localhost*" compareCaseSensitive="false" />
</rules>
</add>
</manyToOneMappings>
</iisClientCertificateMappingAuthentication>
<windowsAuthentication enabled="false">
<providers>
<add value="Negotiate" />
<add value="NTLM" />
</providers>
</windowsAuthentication>
</authentication>
这里是我的接入节点:
<access sslFlags="SslRequireCert" />
注意:用户名/密码=富/酒吧看起来很可疑。为什么这会在用户方面填充?是否有必要的服务帐户与此相关联?
我也试图简单配置:
<authentication>
<anonymousAuthentication enabled="false" userName="" />
<basicAuthentication enabled="false" />
<clientCertificateMappingAuthentication enabled="true" />
<digestAuthentication enabled="false" />
<iisClientCertificateMappingAuthentication enabled="false">
</iisClientCertificateMappingAuthentication>
<windowsAuthentication enabled="false">
<providers>
<add value="Negotiate" />
<add value="NTLM" />
</providers>
</windowsAuthentication>
</authentication>
会发生什么是网页通常呈现,但我没有征求我的客户端证书。
我明显有客户证书,所以我不知道为什么其他网站能够要求他们。
我使用IIS快递10