0

Although my question was more than a year ago and did not ever get an answer, I think I may have found a way to do it. When a web application is running and a second CAC is inserted into an additional reader on the PC, ActivClient reads the card and places the certificate into the store. So I access the store and find the cert by the persons' name:

enter code here
Dean.DePue
  • 1,013
  • 1
  • 21
  • 45

1 Answers1

0
[HttpPost]
    public ActionResult GetNewCardEdipi(string name)
    {
        //test multiple readers
        X509Store keystore = new X509Store(StoreName.My, StoreLocation.CurrentUser);
        keystore.Open(OpenFlags.ReadOnly | OpenFlags.OpenExistingOnly);
        var clientCert = keystore.Certificates;
        var certs = keystore.Certificates.Find(X509FindType.FindBySubjectName, name, false);
        var cuser = certs[0];
        var sub = cuser.Subject;
        string[] strs = sub.Split(',');

        string edi = strs[0].Substring(strs[0].LastIndexOf(".") + 1);
        //end
        return Json(edi);
    }

This works just fine.

Dean.DePue
  • 1,013
  • 1
  • 21
  • 45