Hello:
I am trying to fix the login screen on my web that uses CAC card to login. This code below grabs the ID from a CAC card and display on the screen. This piece of code is working perfectly fine on one server but the other. I am wondering what configuration on the server that I need to change in order for this code to work. Please advice. Thank you.
<%@ Page Language="C#" AutoEventWireup="true"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"><title>Untitled Page</title><script language="C#" runat="server">
public string GetID()
{
HttpClientCertificate myCert = HttpContext.Current.Request.ClientCertificate;
if (myCert.IsPresent)
{
return myCert.Subject.Substring(myCert.Subject.Length - 10, 10);
}
else
{
return "0";
}
}
protected void Page_Load(object sender, EventArgs e)
{
string strValue = GetID();
if (strValue != "0")
{
lblMessage.Text = "YOUR ID NUMBER IS:<br><br>" + strValue;
}
else
{
lblMessage.Text = "You don't have access";
}
}
</script></head><body><form id="form1" runat="server"><div><asp:Label ID="lblMessage" Font-Bold="true" ForeColor="Green" Font-Size="X-Large" runat="server" /></div></form></body></html>