protected void Page_Load(object sender, EventArgs e) { if (Session["capchaimgvna"] != null) { if (Convert.ToInt32(Session["capchaimgvna"]) >= 3) { this.pnlcapcha.Visible = true; } else { this.pnlcapcha.Visible = false; } } else { this.pnlcapcha.Visible = false; } HttpCookie cookie = Request.Cookies["hpcinfomation"]; if (cookie != null) { object _Username = cookie["hpcUserNames"]; object _Password = cookie["hpcPassword"]; if (_Username != null && _Password != null) { user = _userDAL.GetUserByUserPass(_Username.ToString(), HPCSecurity.Encrypt(_Password.ToString())); if (user != null) { if (user.UserName.Trim() == _Username.ToString() && _Password.ToString() == user.UserPass.Trim()) { FormsAuthentication.SetAuthCookie(user.UserName, false); Response.Redirect(Global.ApplicationPath + "/Default.aspx"); } } } } txtUsername.Focus(); if (!IsPostBack) { FillCapctha(); } }