Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string xmlCard = Request.Params["xmlToken"];
            if (xmlCard != null)
            {
                Token t = new Token(xmlCard);
                string cardConfig = Request.MapPath("App_Data\\AuthEPCard.ini");
                string cardoutDir = Request.MapPath("Cards\\");
                string cardOutFile = Guid.NewGuid().ToString() + DateTime.Now.Ticks + ".crd";
                string cardOut = cardoutDir + cardOutFile;

                string ppid = t.Claims[ClaimTypes.PPID];
                if (ManagedCardWriter.CreateCard(cardConfig, cardOut, ppid))
                {
                    string docNumber = DocnumberBox.Text;
                    string dateOfBirth = DateOfBirthBox.Text;
                    string dateOfExpiry = DateOfExpiryBox.Text;
                    if (docNumber == "" || dateOfBirth == "" || dateOfExpiry == "")
                        throw new Exception("Please fill in Document Number, Date of Birth and Date of Expiry.");

                    string base64PPID = BytesToHex(UTF8Encoding.UTF8.GetBytes(ppid));
                    StreamWriter writer = File.CreateText(Request.MapPath("Bac\\" + base64PPID + ".bac"));
                    writer.WriteLine(docNumber);
                    writer.WriteLine(dateOfBirth);
                    writer.WriteLine(dateOfExpiry);
                    writer.Close();
                    Response.Redirect("~/Cards/" + cardOutFile);
                }
                else
                    throw new Exception("Error while creating your card, please try again later.");
            }
        }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     string xmlCard = Request.Params["xmlToken"];
     if (xmlCard != null)
     {
         Token t = new Token(xmlCard);
         string bsn = t.Claims["http://schemas.authep.nl/claims/personalnumber"];
         BSNLabel.Text = "Uw BSN is: " + bsn + " we zullen u gauw verder 'helpen'.";
     }
 }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string xmlCard = Request.Params["xmlToken"];
            if (xmlCard != null)
            {
                Token t = new Token(xmlCard);
                long dateOfBirthTicks = long.Parse(t.Claims[ClaimTypes.DateOfBirth]);
                DateTime dateOfBirth = new DateTime(dateOfBirthTicks);
                int age = (int)(DateTime.Now - dateOfBirth).Days / 365;

                SurnameLabel.Text = "Name: "+t.Claims[ClaimTypes.Surname].Replace("<"," ");
                DateOfBirthLabel.Text = "Born: "+dateOfBirth.ToShortDateString()+" you are: "+ age+" years.";
                if (age > 18)
                    ResultLabel.Text = "You are old enough! Go buy some!";
                else
                    ResultLabel.Text = "Sorry only cola for you.";
            }
        }