protected void Page_Load(object sender, EventArgs e) { Random lcRand = new Random(); int lnRandVal = lcRand.Next(); string lcString = lnRandVal.ToString("X") + lnRandVal.ToString("X"); gcKeyLabel.Text = lcString + "-" + StaticMethods.CalculateMD5Hash(lcString).Substring(0, 8); if (HttpContext.Current.Request.UserAgent.Contains("Chrome") == true || HttpContext.Current.Request.UserAgent.Contains("Firefox") == true) { gcBody.Attributes.Add("style", tcBgStyler.Instance.GetBgImageStyle()); } }
private bool IsAuthKeyValid(string apanKey) { bool lbEqual = false; string lpanRand = apanKey.Substring(0, apanKey.IndexOf('-')); string lpanRandHash = StaticMethods.CalculateMD5Hash(lpanRand).Substring(0, 8); string lpanHash = apanKey.Substring(apanKey.IndexOf('-') + 1); if (lpanHash.Equals(lpanRandHash)) { lbEqual = true; } return(lbEqual); }