Beispiel #1
0
        protected string IsCurrent()
        {
            AuthString aStr = null;

            if (aStr != null)
            {
                return(aStr.IsCurrent() ?"Current":"Not Current");
            }
            else
            {
                return("");
            }
        }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     t = (DataTable)Session["table"];
     if (t == null)
     {
         t = new DataTable();
         t.Columns.Add("User ID");
         t.Columns.Add("TimeStamp");
         t.Columns.Add("Hash");
         t.Columns.Add("LastChecked");
         t.Columns.Add("IsCurrent");
         t.PrimaryKey = new DataColumn[] { t.Columns["Hash"] };
         Session.Add("table", t);
     }
     if ((Request["id"] != null) && (!Page.IsPostBack))
     {
         AuthString aStr = new AuthString(Request["id"], DateTime.Parse(Request["ts"]).ToUniversalTime(), SECRET);
         if (!aStr.IsValid(Request["hash"]))
         {
             ErrorPanel.Text    = "Bad Hash Detected";
             ErrorPanel.Enabled = true;
         }
         else
         {
             ErrorPanel.Enabled = false;
             t.Rows.Add(Request["id"], Request["ts"], Request["hash"], DateTime.UtcNow.ToString("u"), aStr.IsCurrent() ? "Current" : "Not Current");
         }
     }
     Session["table"]      = t;
     DataOutput.DataSource = t;
     DataOutput.DataBind();
 }