protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Session["s_forceChange"] as string)) { if (HttpContext.Current.Request.Url.AbsolutePath.Substring(HttpContext.Current.Request.Url.AbsolutePath.Length - 19, 19) != "changepassword.aspx") { Response.Redirect(Session["s_forceChange"].ToString(), false); } } if (!IsPostBack) { //lnkChangePasswd.HRef = "changepassword.aspx?" + Request.QueryString; //lnkDayofExpired.HRef = "dayofexpired.aspx?" + Request.QueryString; if (PH_Utility.GetCookie(Request, ConfigurationManager.AppSettings["PH_NameUserCookie"]) == "" && PH_Utility.GetCookie(Request, ConfigurationManager.AppSettings["PH_RoleUserCookie"]) == "") { Response.Redirect("login.aspx", false); } //else if (Request["id"] == null) Response.Redirect("logout.aspx", false); else { eStatus = new PHCore_Status(); string strRoleId = PH_EncrptHelper.MD5Decryp(PH_Utility.GetCookie(Request, ConfigurationManager.AppSettings["PH_RoleUserCookie"])); if (strRoleId != "") { eStatus.RoleId = (PHCore_Status.RoleID)Enum.Parse(typeof(PHCore_Status.RoleID), strRoleId, true); } GenMenu(); } } }
protected static string GetUserName(HttpRequest request) { string strUserName = ""; strUserName = PH_Utility.GetCookie(request, ConfigurationManager.AppSettings["PH_NameUserCookie"]); return(strUserName == "" ? strUserName : PH_EncrptHelper.MD5Decryp(strUserName)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //lnkChangePasswd.HRef = "changepassword.aspx?" + Request.QueryString; //lnkDayofExpired.HRef = "dayofexpired.aspx?" + Request.QueryString; if (PH_Utility.GetCookie(Request, ConfigurationManager.AppSettings["PH_NameUserCookie"]) == "" && PH_Utility.GetCookie(Request, ConfigurationManager.AppSettings["PH_RoleUserCookie"]) == "") { Response.Redirect("login.aspx", false); } else if (Request["id"] == null) { Response.Redirect("logout.aspx", false); } else { eStatus = new PHCore_Status(); string strRoleId = PH_EncrptHelper.MD5Decryp(PH_Utility.GetCookie(Request, ConfigurationManager.AppSettings["PH_RoleUserCookie"])); if (strRoleId != "") { eStatus.RoleId = (PHCore_Status.RoleID)Enum.Parse(typeof(PHCore_Status.RoleID), strRoleId, true); } GenMenu(); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { if (PH_EncrptHelper.MD5Decryp(Request["p"]) == txtPassword.Text) { lblErr.Text = ConfigurationManager.AppSettings["PH_Error_PasswordExpired"]; } else { var rtn = PHCore_User.ChangePasswd(AppCode.strConnDB, Request["id"], txtPassword.Text, DateTime.ParseExact(txtPasswordExpired.Text, "dd/MM/yyyy", null)); if (rtn > 0) { Response.Redirect("login.aspx", false); } } } catch (Exception ex) { lblErr.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } }
protected void Button1_Click(object sender, EventArgs e) { TextBox1.Text = PH_EncrptHelper.MD5Decryp(TextBox1.Text); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { /*eStatus = new PHCore_Status(); * string strRoleId = PH_EncrptHelper.MD5Decryp(PH_Utility.GetCookie(Request, ConfigurationManager.AppSettings["PH_RoleUserCookie"])); * if( strRoleId != "" ) * eStatus.RoleId = (PHCore_Status.RoleID)Enum.Parse(typeof(PHCore_Status.RoleID), strRoleId, true);*/ #region Check Type string[] type = (Request["type"] != null) ? Request["type"].Split(',') : null; if (type != null && type[0] == PHCore_Status.RoleID.A1.ToString()) { divContact.Visible = false; divHaulier.Visible = false; divVender.Visible = false; } else if (type != null && type[0] == PHCore_Status.RoleID.HL.ToString()) { divVender.Visible = false; divRole.Visible = false; } else if (type != null && type[0] == PHCore_Status.RoleID.VD.ToString()) { divHaulier.Visible = false; divRole.Visible = false; divVender.Visible = false; } else if (type != null && type[0] == PHCore_Status.RoleID.B1.ToString()) { divContact.Visible = false; divHaulier.Visible = false; divVender.Visible = false; } else if (type != null && type[0] == PHCore_Status.RoleID.F1.ToString()) { divContact.Visible = false; divHaulier.Visible = false; divVender.Visible = false; } else if (type != null && type[0] == PHCore_Status.RoleID.I1.ToString()) { divContact.Visible = false; divHaulier.Visible = false; divVender.Visible = false; } else if (type != null && type[0] == PHCore_Status.RoleID.BH.ToString()) { divHaulier.Visible = false; divRole.Visible = false; divVender.Visible = false; } else { Response.Redirect("logout.aspx", false); } #endregion if (PH_EncrptHelper.MD5Decryp(Request.Cookies["PH_RoleUserCookie"].Value) == "A2" && Request.QueryString["type"].ToString() != "VD") { btnSubmit.Style["visibility"] = "hidden"; } lblHeader.Text = (type != null) ? ConfigurationManager.AppSettings["PH_AddNew_" + type[0]] : ""; txtPasswrdExpried.Text = DateTime.Now.AddDays(AppCode.GetDayofPasswdExp(Page)).ToString("dd/MM/yyyy"); } catch (Exception ex) { lblError.Text = ex.Message; PH_ExceptionManager.WriteError(ex.Message); } } }