protected void Btn_submit_Click(object sender, EventArgs e) { try { objReg.UserName = Txt_id.Text; objReg.PASSWORD = ENC_DEC.Encode_Decode.EncodeTo64(Txt_pwd.Text).ToString(); DataSet ds = objReg.VerifyLogin(objReg); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { Session["CODE"] = ds.Tables[0].Rows[0]["CODE"].ToString(); Session["ID"] = ds.Tables[0].Rows[0]["ID"].ToString(); Session["TYP"] = ds.Tables[0].Rows[0]["TYP"].ToString(); Session["NAME"] = ds.Tables[0].Rows[0]["NAME"].ToString(); Session["IMG"] = ds.Tables[0].Rows[0]["IMG"].ToString(); //if (chkRemPwd.Checked == true) if (1 == 1) { HttpCookie pwdCookie = new HttpCookie("pwdCookie"); pwdCookie.Values.Add("CODE", Session["CODE"].ToString()); pwdCookie.Values.Add("ID", Session["ID"].ToString()); pwdCookie.Values.Add("TYP", Session["TYP"].ToString()); pwdCookie.Values.Add("NAME", Session["NAME"].ToString()); pwdCookie.Values.Add("IMG", Session["IMG"].ToString()); pwdCookie.Expires = DateTime.Now.AddYears(50); Response.Cookies.Add(pwdCookie); } Response.Redirect("~/ADMIN/Dashboard.aspx", false); } } catch (Exception ex) { Session["CODE"] = null; Session["ID"] = null; Session["TYP"] = null; Session["NAME"] = null; Session["IMG"] = null; } }
protected void Btn_submit_Click(object sender, EventArgs e) { try { objReg.UserName = Txt_id.Text; objReg.PASSWORD = ENC_DEC.Encode_Decode.EncodeTo64(Txt_pwd.Text).ToString(); objReg.TYPE = ddlType.SelectedValue.ToString(); DataSet ds = objReg.VerifyLogin(objReg); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { if (ddlType.SelectedValue == "1") { Session["CODE"] = ds.Tables[0].Rows[0]["ECM_CODE"].ToString(); Session["ID"] = ds.Tables[0].Rows[0]["ECM_CODE"].ToString(); Session["TYP"] = ddlType.SelectedValue.ToString();//ds.Tables[0].Rows[0]["CMP_TYP"].ToString(); Session["NAME"] = ds.Tables[0].Rows[0]["ECM_NAME"].ToString(); Session["IMG"] = ds.Tables[0].Rows[0]["ECM_PHOTO"].ToString(); } else { Session["CODE"] = ds.Tables[0].Rows[0]["ECM_CODE"].ToString(); Session["ID"] = ds.Tables[0].Rows[0]["ECM_CODE"].ToString(); Session["TYP"] = ddlType.SelectedValue.ToString();//ds.Tables[0].Rows[0]["CMP_TYP"].ToString(); Session["NAME"] = ds.Tables[0].Rows[0]["ECM_NAME"].ToString(); Session["IMG"] = ds.Tables[0].Rows[0]["ECM_PHOTO"].ToString(); } if (1 == 1) { HttpCookie pwdCookie = new HttpCookie("pwdProtechziCookie"); pwdCookie.Values.Add("CODE", Session["CODE"].ToString()); pwdCookie.Values.Add("ID", Session["ID"].ToString()); pwdCookie.Values.Add("TYP", Session["TYP"].ToString()); pwdCookie.Values.Add("NAME", Session["NAME"].ToString()); pwdCookie.Values.Add("IMG", Session["IMG"].ToString()); pwdCookie.Expires = DateTime.Now.AddYears(50); Response.Cookies.Add(pwdCookie); } if (ddlType.SelectedValue == "1") { Response.Redirect("~/ADMIN/Dashboard.aspx", false); } else if (ddlType.SelectedValue == "2") { Response.Redirect("~/EMPLOYEE/Default.aspx", false); } else { // Response.Redirect("~/Accounts/Dashboard.aspx", false); } } } catch (Exception ex) { Session["CODE"] = null; Session["ID"] = null; Session["TYP"] = null; Session["NAME"] = null; Session["IMG"] = null; } }