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 (!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 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(); } } }
private void storeUser(PrimaryHaul_WSFlow.PHCore_Status status) { try { PH_Utility.CreateCookie(PH_EncrptHelper.MD5Encryp(status.UserName), Response, ConfigurationManager.AppSettings["PH_NameUserCookie"], int.Parse(ConfigurationManager.AppSettings["PH_TimeUserCookie"])); PH_Utility.CreateCookie(PH_EncrptHelper.MD5Encryp(status.RoleId.ToString()), Response, ConfigurationManager.AppSettings["PH_RoleUserCookie"], int.Parse(ConfigurationManager.AppSettings["PH_TimeUserCookie"])); PH_Utility.CreateCookie(PH_EncrptHelper.MD5Encryp(status.Status.ToString()), Response, ConfigurationManager.AppSettings["PH_StatusUserCookie"], int.Parse(ConfigurationManager.AppSettings["PH_TimeUserCookie"])); } catch (Exception ex) { throw new Exception("storeUser >>" + ex.Message); } }