protected void btnLogin_Click(object sender, EventArgs e) { try { StoreFront objStoreFront = new StoreFront(); DataSet ds = new DataSet(); ds = objStoreFront.GetLoginUser(txtUserName.Text.Trim(), txtpassword.Text.Trim()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["IsActive"].ToString().ToLower() == "false") { Session["UserName"] = ds.Tables[0].Rows[0]["UserName"].ToString(); Session["MemberName"] = ds.Tables[0].Rows[0]["FullName"].ToString(); Session["UserID"] = ds.Tables[0].Rows[0]["UserID"].ToString(); Session["IsLogin"] = "******"; Session["UserType"] = ds.Tables[0].Rows[0]["UserType"].ToString(); lblLoginerror.Visible = false; Response.Redirect("~/mobileweb/MB_index.aspx"); } else { lblLoginerror.Visible = true; lblLoginerror.Text = "Your Account Is Disabled By Administrator of This Site. Please Contact Administrator."; } } else { lblLoginerror.Visible = true; } } catch (Exception ex) { throw ex; } }
protected void btnLogin_Click(object sender, ImageClickEventArgs e) { StoreFront objStoreFront = new StoreFront(); DataSet ds = new DataSet(); ds = objStoreFront.GetLoginUser(txtUsername.Text.Trim(), txtPassword.Text.Trim()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["IsActive"].ToString().ToLower() == "false") { Session["MemberName"] = ds.Tables[0].Rows[0]["FullName"].ToString(); Session["UserID"] = ds.Tables[0].Rows[0]["UserID"].ToString(); Session["IsLogin"] = "******"; Session["UserType"] = ds.Tables[0].Rows[0]["UserType"].ToString(); lblLoginerror.Visible = false; if (chkRemember.Checked == true) { HttpContext.Current.Request.Cookies.Clear(); if (Request.Cookies["remUsername"] == null) { HttpCookie c = new HttpCookie("remUsername", txtUsername.Text); c.Expires = DateTime.Now.AddDays(Convert.ToDouble(ConfigurationManager.AppSettings["addCookieForDay"])); Response.Cookies.Add(c); } if (Request.Cookies["remPassword"] == null) { HttpCookie c = new HttpCookie("remPassword", txtPassword.Text); c.Expires = DateTime.Now.AddDays(Convert.ToDouble(ConfigurationManager.AppSettings["addCookieForDay"])); Response.Cookies.Add(c); } } else { Response.Cookies["remUsername"].Expires = DateTime.Now.AddYears(-30); Response.Cookies["remPassword"].Expires = DateTime.Now.AddYears(-30); } Response.Redirect("index.aspx"); } else { lblLoginerror.Visible = true; lblLoginerror.Text = "Your Account Is Disabled By Administrator of This Site/n Please Contact Administrator."; } } else { lblLoginerror.Visible = true; ModalLogin.Show(); } }
protected void Page_Load(object sender, EventArgs e) { /* * Session["MemberName"] = Use for Registered User Name * Session["UserID"] = Used For database User ID * Session["IsLogin"] used for to chaeck User is login or not * Session["UserType"] Used for User type that is * 1 - Cat User * 2 - Dog User * 3 - Cat-Dog User * Default Cat-Dog User * Cookies["IsLogin"] is used to check whether user is login or not which will work irrespective to remember me on this PC */ if (Request.Cookies["IsLogin"] == null) { HttpCookie c = new HttpCookie("IsLogin", "0"); c.Expires = DateTime.Now.AddDays(Convert.ToDouble(ConfigurationManager.AppSettings["addCookieForDay"])); Response.Cookies.Add(c); } if ((Request.Cookies["remUsername"] != null) && (Request.Cookies["remPassword"] != null) && (Request.Cookies["IsLogin"].Value.ToString() == "1")) { if (Session["MemberName"] != null && Session["UserID"] != null && Session["UserName"] != null) { string UserName = Request.Cookies["remUsername"].Value.ToString(); string Password = Request.Cookies["remPassword"].Value.ToString(); StoreFront objStoreFront = new StoreFront(); DataSet ds = new DataSet(); ds = objStoreFront.GetLoginUser(UserName, Password); if (ds.Tables[0].Rows.Count > 0) { Session["UserName"] = ds.Tables[0].Rows[0]["UserName"].ToString(); Session["MemberName"] = ds.Tables[0].Rows[0]["FullName"].ToString(); Session["UserID"] = ds.Tables[0].Rows[0]["UserID"].ToString(); Session["IsLogin"] = "******"; Session["UserType"] = ds.Tables[0].Rows[0]["UserType"].ToString(); } } } else { Session["UserType"] = "4"; } /* * If User is registered and use remember me on this PC then Load Header_Logout.ascx Control ( Myaccount Link , Logout button ) * else Load Header_Login.ascx ( Registration Link and Ligin Button ) * */ if (Session["MemberName"] != null) { Control bodyCntrl = LoadControl("~/Controls/Header_Logout.ascx"); PhHeader.Controls.Add(bodyCntrl); } else { Control bodyCntrl = LoadControl("~/Controls/Header_Login.ascx"); PhHeader.Controls.Add(bodyCntrl); } /* Meta of Page */ string sPath = GetCurrentPageName(); Global ObjGlobal = new Global(); DataSet ds_Meta = new DataSet(); ds_Meta = ObjGlobal.GetMetaFront(sPath); if (ds_Meta.Tables[0].Rows.Count > 0) { DataRow row = ds_Meta.Tables[0].Rows[0]; string Description = Convert.ToString(row["MetaContent"]); string Keywords = Convert.ToString(row["Keywords"]); if (Description != string.Empty) { HtmlMeta meta = new HtmlMeta(); meta.Name = "Description"; meta.Content = Description; Page.Header.Controls.Add(meta); } if (Keywords != string.Empty) { HtmlMeta Keyword = new HtmlMeta(); Keyword.Name = "keywords"; Keyword.Content = Keywords; Page.Header.Controls.Add(Keyword); } } if (ds_Meta.Tables[1].Rows.Count > 0) { Page.Title = ds_Meta.Tables[1].Rows[0]["PageTitle"].ToString(); } }
/* * On clickin this button will check the user validation and Authenticatio of user then set UserType, cookie, * On error it will show message */ protected void btnLogin_Click(object sender, ImageClickEventArgs e) { StoreFront objStoreFront = new StoreFront(); DataSet ds = new DataSet(); ds = objStoreFront.GetLoginUser(txtUsername.Text.Trim(), txtPassword.Text.Trim()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["IsActive"].ToString().ToLower() == "false") { Session["UserName"] = ds.Tables[0].Rows[0]["UserName"].ToString(); Session["MemberName"] = ds.Tables[0].Rows[0]["FullName"].ToString(); Session["UserID"] = ds.Tables[0].Rows[0]["UserID"].ToString(); Session["IsLogin"] = "******"; Session["UserType"] = ds.Tables[0].Rows[0]["UserType"].ToString(); if (chkRemember.Checked == true) { Request.Cookies.Remove("remUsername"); Request.Cookies.Remove("remPassword"); HttpContext.Current.Request.Cookies.Clear(); var cookieTextUserName = Encoding.UTF8.GetBytes(txtUsername.Text); var cookieTextUserPassword = Encoding.UTF8.GetBytes(txtPassword.Text); var encryptedUserNameValue = Convert.ToBase64String(MachineKey.Protect(cookieTextUserName, "myAdminKey")); var encryptedPasswordValue = Convert.ToBase64String(MachineKey.Protect(cookieTextUserPassword, "myAdminKey")); HttpCookie c = new HttpCookie("remUsername", encryptedUserNameValue); c.Expires = DateTime.Now.AddDays(Convert.ToDouble(ConfigurationManager.AppSettings["addCookieForDay"])); Response.Cookies.Add(c); HttpCookie c1 = new HttpCookie("remPassword", encryptedPasswordValue); c1.Expires = DateTime.Now.AddDays(Convert.ToDouble(ConfigurationManager.AppSettings["addCookieForDay"])); Response.Cookies.Add(c1); if (Request.Cookies["IsLogin"] == null) { HttpCookie c2 = new HttpCookie("IsLogin", "1"); c2.Expires = DateTime.Now.AddDays(Convert.ToDouble(ConfigurationManager.AppSettings["addCookieForDay"])); Response.Cookies.Add(c2); } Response.Redirect(string.Concat(Convert.ToString(Session["HomePath"]), "Appointmentnew.aspx")); } else { Response.Cookies["remUsername"].Expires = DateTime.Now.AddYears(-30); Response.Cookies["remPassword"].Expires = DateTime.Now.AddYears(-30); HttpCookie c = new HttpCookie("IsLogin", "0"); c.Expires = DateTime.Now.AddDays(Convert.ToDouble(ConfigurationManager.AppSettings["addCookieForDay"])); Response.Cookies.Add(c); Response.Redirect(string.Concat(Convert.ToString(Session["HomePath"]), "Appointmentnew.aspx")); } } else { lblLoginerror.Visible = true; lblLoginerror.Text = "Your account Has been disabled by administrator of this site ,please contact administrator"; ModalLogin.Show(); } } else { lblLoginerror.Visible = true; ModalLogin.Show(); } }
/* * PlaceHolder is used to hole flash file as the file is set from Admin = * This file will change as per user type 1(Cat) 2(Dog) 3(cat&Dog) */ protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { #region Check SignOut try { if (!string.IsNullOrEmpty(Request.QueryString.ToString())) { string strReq = ""; strReq = Request.RawUrl; strReq = strReq.Substring(strReq.IndexOf('?') + 1); if (!strReq.Equals("")) { strReq = DecryptQueryString(strReq); string[] arrMsgs = strReq.Split('&'); string[] arrIndMsg; arrIndMsg = arrMsgs[0].Split('='); //Get the Signout string strMsg = arrIndMsg[1].ToString().Trim(); if (strMsg == "SignOut") { clearHiistory(); } } } } catch { clearHiistory(); } #endregion #region Code if ((Request.Cookies["remUsername"] != null) && (Request.Cookies["remPassword"] != null) && (Request.Cookies["IsLogin"].Value.ToString() == "1"))// && (Session["IsLogin"] == null)) { if ((Session["MemberName"] != null) && (Session["UserID"] != null) && Session["UserName"] != null) { string UserName = Request.Cookies["remUsername"].Value.ToString(); string Password = Request.Cookies["remPassword"].Value.ToString(); StoreFront objStoreFront = new StoreFront(); DataSet ds = new System.Data.DataSet(); ds = objStoreFront.GetLoginUser(UserName, Password); if (ds.Tables[0].Rows.Count > 0) { Session["UserName"] = ds.Tables[0].Rows[0]["UserName"].ToString(); Session["MemberName"] = ds.Tables[0].Rows[0]["FullName"].ToString(); Session["UserID"] = ds.Tables[0].Rows[0]["UserID"].ToString(); Session["IsLogin"] = "******"; Session["UserType"] = ds.Tables[0].Rows[0]["UserType"].ToString(); } } } BindData(); if (Session["MemberName"] != null) { divUserName.Attributes.Add("style", "Display:block"); lblWelcome.Text = "Welcome - " + Session["MemberName"].ToString(); DataSet ds = new DataSet(); if (!(null == Session["UserName"])) { ctlZipcode.Visible = false; imgbtnMakePayment.Visible = true; } else { divUserName.Attributes.Add("style", "Display:none"); ctlZipcode.Visible = true; imgbtnMakePayment.Visible = false; } } #endregion } }