persistantcookie=true
private void ValidateLogin(string emailAddress, string password) { try { UserInfo objUserInfo = null; objUserInfo = Gateway.Users.ValidateLogin(emailAddress, password); if (objUserInfo == null || objUserInfo.UserID == 0) { lblError.Text = IEC_Common.Messages.MSG_INVALID_USERNAME_PWD; trErrorMsg.Visible = true; return; } //if (!IEC_Data_Access.DatabaseUtility.ValidateLogin(emailAddress, password, ref objUserInfo)) //{ // lblError.Text = IEC_Common.Messages.MSG_INVALID_USERNAME_PWD; // trErrorMsg.Visible = true; // return; //} LoginManager.LogInUser(objUserInfo); // Create the cookie that contains the forms authentication ticket HttpCookie authCookie = FormsAuthentication.GetAuthCookie(emailAddress, true); // Get the FormsAuthenticationTicket out of the encrypted cookie FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value); // Create a new FormsAuthenticationTicket that includes our custom User Data FormsAuthenticationTicket newTicket = new FormsAuthenticationTicket(ticket.Version, ticket.Name, ticket.IssueDate, ticket.Expiration, ticket.IsPersistent, ""); // Update the authCookie's Value to use the encrypted version of newTicket authCookie.Value = FormsAuthentication.Encrypt(newTicket); // Manually add the authCookie to the Cookies collection Response.Cookies.Add(authCookie); // Determine redirect URL and send user there string redirUrl = FormsAuthentication.GetRedirectUrl(emailAddress, chkLogin.Checked); //if (!redirUrl.Contains("MENU_ID=")) //{ // redirUrl += "?MENU_ID=35"; //} Response.Redirect(Navigation.GetTamperProofURL(redirUrl)); } catch (Exception ex) { lblError.Text = ex.Message; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)