private bool LoginAuth(string UserName, string Password) { _UserDetailsBusinessLogic = new UserDetailsBusinessLogic(); if (_UserDetailsBusinessLogic.IsExistingUser(UserName, Password)) { var authTicket = new FormsAuthenticationTicket(1, UserName, DateTime.Now, DateTime.Now.AddMinutes(20), false, "test" ); string encryptedTicket = FormsAuthentication.Encrypt(authTicket); var authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); Response.Cookies.Add(authCookie); return(true); } else { return(false); } }