简体   繁体   English

浏览器不读取客户端证书

[英]Browser not Reading client certificate

I am trying to read a certificate using the following code我正在尝试使用以下代码读取证书

if (Page.Request.ClientCertificate.IsPresent)
{
    HttpClientCertificate cs = Request.ClientCertificate;
    string entireSubjectLine = cs.Subject.ToString();

    if (entireSubjectLine != "")
    {
        lblResponse.Text = entireSubjectLine;
    }
    else
    {
        lblResponse.Text = "No Data";
    }
}

This line - if (Page.Request.ClientCertificate.IsPresent) is returning false , means certificate is not being read.此行 - if (Page.Request.ClientCertificate.IsPresent)返回false ,则表示未读取证书。 How to achieve it?如何实现?

This is how you configure IIS to accept certificates:这是配置 IIS 以接受证书的方式:

ssl 设置

接受客户证书

This seems to make your site ask for certificates though, even if you use Accept and not Require .这似乎使您的站点要求证书,即使您使用Accept而不是Require

Not sure if you want that.不确定你是否想要那个。

This is for IIS.这是针对 IIS 的。 For IIS Express you can see here: https://improveandrepeat.com/2017/07/how-to-configure-iis-express-to-accept-ssl-client-certificates/对于 IIS Express,您可以在此处查看: https : //improveandrepeat.com/2017/07/how-to-configure-iis-express-to-accept-ssl-client-certificates/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM