Request a client certificate using Asp.net MVC

I am trying to extract a client certificate from a client browser for user authentication. I know that I can create a folder with the same name as the controller, and using IIS install the required client certificate for my SSL settings. Actually, I tried this and it worked, but I cannot use this approach because there are other actions in the controller that do not require a request from the client for the client certificate. I also need to ask the client certificate in different controllers.

So, do you know a clean (if possible) way to suggest the user to select a client certificate?

+6
source share
2 answers

There are several prerequisites.

Trusted CA root certificate. Server Certificate from a trusted CA. Client Certificate from a trusted CA. 

you can see this article to set up the initial configuration in IIS: How to configure an IIS client certificate

0
source

try using this [RequireHttps] attribute for the action / controller if you need to protect it with an ssl certificate.

-1
source

Source: https://habr.com/ru/post/902246/


All Articles