protected void btnLogin_Click(object sender, EventArgs e) { HttpCookie uLoginIP = Request.Cookies["uLoginIP"]; String iuser = txtUserID.Text.Replace(" ", "").ToUpper(); String ipass = txtPassword.Text; HttpCookie uLogincook = new HttpCookie("uLoginInfo"); try { //EncryptingappSettings(); if (isCompleteLogin() && uLoginIP != null) { uLogincook["ACode"] = System.Configuration.ConfigurationManager.AppSettings.Get("AuthenticationCode"); string hpassword = sl.SHA256Hasing(ipass); DataTable iResult = SystemLogic.CollectionHelper.ConvertTo(usc.GetStudent(uLoginIP["IPAddress"], System.Configuration.ConfigurationManager.AppSettings.Get("AuthenticationCode"), "", iuser, hpassword, "", "", "", "", "", "", "true")); if (iResult != null && iResult.Rows.Count == 1) { uLogincook["Name"] = iResult.Rows[0]["FullName"].ToString(); uLogincook["ID"] = iResult.Rows[0]["ID"].ToString(); uLogincook["LoginID"] = iResult.Rows[0]["LoginID"].ToString(); Response.Cookies.Add(uLogincook); Response.Redirect("Default.aspx", false); } else { Response.Write("<script LANGUAGE='JavaScript' >alert('Incorrect User Information!')</script>"); } } } catch (Exception ex) { Response.Write("<script LANGUAGE='JavaScript' >alert('Please contact administrator for assistant.')</script>"); if (uLogincook != null && uLoginIP != null) { al.WriteErrorLog(ex.Message, "Login Click", "IP Address=" + uLoginIP["IPAddress"] + ",LoginID=" + iuser + ",Password(Before Encrypt)=+" + ipass); } } }