目标
我需要在浏览器上打开这个JavaScript证书模态框,让用户选择他们的证书(它是用葡萄牙语显示的,抱歉):
然后将其保存到我的Action
中,如下所示:
[HttpGet]
public ActionResult GetClientCertificate() {
var requestCertificate = System.Web.HttpContext.Current.Request.ClientCertificate;
///Transform to byte[] and save on DataBase
}
问题
因为这是我第一次接触这种技术,所以我花费了很多时间进行研究,但无论我做什么,模态框都不会弹出,ClientCertificate
始终为空。真的有可能在JavaScript上实现这个吗?
背景
ISS配置
<access sslFlags="SslNegotiateCert" />
<applicationDependencies>
<application name="Active Server Pages" groupId="ASP" />
</applicationDependencies>
<authentication>
<anonymousAuthentication enabled="true" userName="" />
<basicAuthentication enabled="false" />
<clientCertificateMappingAuthentication enabled="true" />
<digestAuthentication enabled="false" />
<iisClientCertificateMappingAuthentication enabled="true">
</iisClientCertificateMappingAuthentication>
<windowsAuthentication enabled="false">
<providers>
<add value="Negotiate" />
<add value="NTLM" />
</providers>
</windowsAuthentication>
</authentication>
<authorization>
<add accessType="Allow" users="*" />
</authorization>
JS
$(document).on("click", "#btnCertificate", function() {
$.get("/Gerenciamento/CertificadoDigital/GetCertificate", null, function(data) {
//// Redirect to other page
});
});
链接
以下是目前我看到的问题(其中一半未回答):