protected void UserAuthenticate(object sender, AuthenticateEventArgs e) { if (Membership.ValidateUser(this.LoginForm.UserName, this.LoginForm.Password)) { e.Authenticated = true; return; } string url = string.Format( this.ForumAuthUrl, HttpUtility.UrlEncode(this.LoginForm.UserName), HttpUtility.UrlEncode(this.LoginForm.Password) ); WebClient web = new WebClient(); string response = web.DownloadString(url); if (response.Contains(groupId)) { e.Authenticated = Membership.ValidateUser("Premier Subscriber", "danu2HEt"); this.LoginForm.UserName = "******"; HttpCookie cookie = new HttpCookie("ForumUsername", this.LoginForm.UserName); cookie.Expires = DateTime.Now.AddMonths(2); Response.Cookies.Add(cookie); } }
protected void lgnLogin_Authenticate(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e) { try { Login loLogin = (Login)sender; TextBox txtBaseDatos = (TextBox)loLogin.FindControl("DataBase"); Administrador loAdministrador = new Administrador(); Cifrado loCifrado = new Cifrado(Criptografia.Comun.Definiciones.TipoCifrado.AES); loConexion = new Conexion() { BaseDatos = txtBaseDatos.Text, Credenciales = new Credenciales() { Cifrado = loCifrado, Contrasenia = loCifrado.Cifrar(loLogin.Password), Usuario = loLogin.UserName }, IdAplicacion = ConfigurationManager.AppSettings["ID"], Tipo = Definiciones.TipoConexion.CredencialesExplicitas, TipoCliente = Definiciones.TipoCliente.Oracle }; Sesion loSesion = loAdministrador.ObtenerSesion(loConexion); e.Authenticated = loSesion.Estatus == Seguridad.Comun.Definiciones.EstatusSesion.Iniciada; Session["Sesion"] = loSesion; } catch (Exception) { e.Authenticated = false; } }
protected void login_Authenticate(object sender, AuthenticateEventArgs e) { string lgn = login.UserName; string pass = login.Password; e.Authenticated = SecurityService.SecurityServiceInstance.Login(lgn, pass); }
protected void AuthenticateUser(object sender, AuthenticateEventArgs e) { SqlConnection con = new SqlConnection(connection); SqlCommand cmd = new SqlCommand("spAuthenticateUser1", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@email", ctrlLogin.UserName); cmd.Parameters.AddWithValue("@password", ctrlLogin.Password); con.Open(); int value = Convert.ToInt32(cmd.ExecuteScalar()); // con.Close(); if (value == 1) { Session["Username"] = ctrlLogin.UserName; FormsAuthentication.RedirectFromLoginPage(ctrlLogin.UserName, false); string sqlquery = "select CustomerID from [SalesLT].[Customer] where EmailAddress = '" + ctrlLogin.UserName + "' "; SqlCommand cmd1 = new SqlCommand(sqlquery, con); int CustomerID = Convert.ToInt32(cmd1.ExecuteScalar()); Session["customerId"] = CustomerID; string sqlquery1 = "select AddressID from [SalesLT].[CustomerAddress] where CustomerID = '" + CustomerID + "' "; SqlCommand cmd2 = new SqlCommand(sqlquery1, con); int AddressID = Convert.ToInt32(cmd2.ExecuteScalar()); Session["AddressId"] = AddressID; Dictionary<int,int> cartItems=new Dictionary<int,int>(); Session["shoppingCart"]=cartItems; } }
protected void Associate_Authenticate(object sender, AuthenticateEventArgs e) { SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AssociateConn"].ConnectionString); SqlCommand cmd = sqlConn.CreateCommand(); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "dbo.Get_Login"; cmd.Parameters.AddWithValue("@id", AssociateLogin.UserName); cmd.Parameters.AddWithValue("@password", AssociateLogin.Password); if (sqlConn.State != ConnectionState.Open) sqlConn.Open(); object o = cmd.ExecuteScalar(); int Authenticated = Convert.ToInt32(cmd.ExecuteScalar()); if (Authenticated == 1) { HttpContext.Current.Session["UserName"] = AssociateLogin.UserName.ToString(); SqlCommand cmdRole = sqlConn.CreateCommand(); cmdRole.CommandType = System.Data.CommandType.StoredProcedure; cmdRole.CommandText = "dbo.Get_RoleByUserID"; cmdRole.Parameters.AddWithValue("@id", AssociateLogin.UserName); SqlDataReader rdr = cmdRole.ExecuteReader(); while (rdr.Read()) { HttpContext.Current.Session["Role"] = rdr["RoleDesc"].ToString(); HttpContext.Current.Session["IsAdmin"] = rdr["IsAdmin"].ToString(); HttpContext.Current.Session.Timeout = 15; } rdr.Close(); Response.Redirect("~/default.aspx"); } sqlConn.Close(); }
/// <summary> /// Solo verifica la Autentidad del usuario /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { //Health.Security.HealthMembershipProvider provider = (Health.Security.HealthMembershipProvider)Membership.Provider; //Fwk.Security.Common.User dbUSer; //try //{ // TextBox UserName = (TextBox)Login1.FindControl("UserName"); // TextBox Password = (TextBox)Login1.FindControl("Password"); // e.Authenticated = provider.ValidateUser(UserName.Text, Password.Text); // //if(e.Authenticated) // // dbUSer = Fwk.Security.FwkMembership.GetUserAnRoles(UserName.Text.Trim(), "sec"); // //Create_HttpCookie(dbUSer, true); // //SessionMannager.Session(this.Session, Application).CurrentUserInfo = Fwk.Security.FwkMembership.GetUserAnRoles(UserName.Text.Trim(), "sec"); // //string err = string.Empty; // //SessionMannager._SessionProxy.InitAuthorizationFactory(out err); // //if (!string.IsNullOrEmpty(err)) // //{ // // Login1.FailureText = err; // // e.Authenticated = false; // //} //} //catch (Exception er) //{ // Login1.FailureText = er.Message; // e.Authenticated = false; //} }
protected void LoginForm_Authenticate(object sender, AuthenticateEventArgs e) { MWRClientLib.ClientProxy proxy = new MWRClientLib.ClientProxy(new MWRClientLib.ClientInterface.ClientInterfaceSoapClient("ClientInterfaceSoap")); ProxyServer.BusinessLayer.ClientAuthStruct auth = new ProxyServer.BusinessLayer.ClientAuthStruct(); auth.UserName = LoginForm.UserName; auth.Password = LoginForm.Password; try { ProxyServer.BusinessLayer.UserDataResponse response = proxy.GetUserData(auth); if (response.ErrorCode == 0) { e.Authenticated = true; List<MWRCommonTypes.MachineWithPrivilleges> machines = new List<MWRCommonTypes.MachineWithPrivilleges>(); foreach (MWRCommonTypes.MachineWithPrivilleges mach in response.MachinesList) { machines.Add(mach); } MWRCommonTypes.User loggedUser = new MWRCommonTypes.User(); loggedUser = response.User; loggedUser.Password = auth.Password; Session["LoggedUser"] = loggedUser; Session["Machines"] = machines.ToArray(); Response.Redirect("Default.aspx"); } LoginForm.FailureText = "Nie udało się zalogować. Kod błędu " + response.ErrorCode.ToString(); } catch (Exception exc) { LoginForm.FailureText = "Nie udało się zalogować. Wystąpił wewnętrzny błąd serwera." + exc.ToString(); } }
protected void Login_Authenticate(object sender, AuthenticateEventArgs e) { String login = Login.UserName; String senha = Login.Password; try { Usuario usr = new Usuario(login, senha); if (usr.LoginUsuario()) { e.Authenticated = true; Session["nome"] = usr.nome; if (usr.getID() == 0) { Session["tipo"] = "Administrador"; Login.DestinationPageUrl = "~/Interface/AdministradorMenu.aspx"; } else { Session["tipo"] = "Jogador"; Session["Id"] = Convert.ToString(usr.getID()); Login.DestinationPageUrl = "~/Interface/JogadorMenu.aspx"; } FormsAuthentication.RedirectFromLoginPage(usr.nome, false); } else { e.Authenticated = false; } } catch { } }
public void Login_Authenticate(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e) { Login login = (Login)sender; string loginUsername = login.UserName; string loginPassword = login.Password; bool isADUser = Membership.Providers["ADMembershipProvider"].ValidateUser(loginUsername, loginPassword); //bool isADUser = true; //loginUsername = "******"; if (isADUser) { string LocalPass = "******"; bool isSSUser = Membership.Providers["FSP_MembershipProvider"].ValidateUser(loginUsername, LocalPass); if (isSSUser) { e.Authenticated = true; } else { e.Authenticated = false; } } else { e.Authenticated = false; } }
protected void login_Authenticate(object sender, AuthenticateEventArgs e) { e.Authenticated = FormsAuthentication.Authenticate(login.UserName, login.Password); if (e.Authenticated) { FormsAuthentication.RedirectFromLoginPage(login.UserName, login.RememberMeSet); } }
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { if (Login1.UserName.CompareTo("") == 0 || Login1.Password.CompareTo("") == 0) e.Authenticated = false; else { try { if (LoginOperations.AdminAuthentication(Login1.UserName, Login1.Password)) { e.Authenticated = true; Session["Username"] = Login1.UserName; Session["AdminRights"] = true; Response.Redirect("AdminHome.aspx"); } else if (LoginOperations.StudentAuthentication(Login1.UserName, Login1.Password)) { e.Authenticated = true; Session["Username"] = Login1.UserName; Session["AdminRights"] = false; Response.Redirect("StudentHome.aspx"); } else { e.Authenticated = false; //lblStatus.Text = "Enter Valid UserName and Password"; } } catch (Exception execption) { e.Authenticated = false; //lblStatus.Text = "Enter Valid UserName and Password"; } } }
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { if (YourValidationFunction(Login1.UserName, Login1.Password)) { SqlConnection sqlConnection = new SqlConnection(BopDBLogin.ConnectionString); String SQLQuery = "SELECT * FROM Usuarios where estado = 'Activo' and rtrim(Usuario)='" + Login1.UserName.ToString().Trim() + "'"; SqlCommand command = new SqlCommand(SQLQuery, sqlConnection); SqlDataReader Dr; sqlConnection.Open(); Dr = command.ExecuteReader(); Dr.Read(); String Perfil = Dr["Perfil"].ToString().Trim(); String Usuario = Dr["Usuario"].ToString(); String Nombre = Dr["Nombre"].ToString().Trim(); getMenu(Perfil); Dr.Close(); // UsuarioLogged.Text = Nombre; Global.Perfil = Perfil; Global.Usuario = Usuario; Global.Nombre = Nombre; Login1.Visible = false; } else { e.Authenticated = false; } }
private void OnAuthenticate(object sender, AuthenticateEventArgs e) { bool Authenticated = false; Authenticated = SiteSpecificAuthenticationMethod(LoginUser.UserName, LoginUser.Password); e.Authenticated = Authenticated; }
protected void OnAuthenticate(object sender, AuthenticateEventArgs e) { var authenticated = false; if (this.LoginUser.UserName == "asd" && this.LoginUser.Password == "168") authenticated = true; e.Authenticated = authenticated; }
protected void LoginUser_OnAuthenticate(object sender, AuthenticateEventArgs e) { // always set to false e.Authenticated = false; Security.AuthenticateUser(LoginUser.UserName, LoginUser.Password, LoginUser.RememberMeSet); }
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { string password = Hash(Login1.Password); using (DataClasses1DataContext db = new DataClasses1DataContext()) { var department = from a in db.Peoples where (a.UserName == Login1.UserName) && (a.PasswordHash == password) select a; foreach( var n in department) { if (n.DepartmentID == 2) { Session["User"] = -1; Response.Redirect("QABugs.aspx"); } else if (n.DepartmentID == 1) { Session["User"] = n.PersonID; Response.Redirect("DevBugs.aspx"); } else if (n.DepartmentID == 3) { Session["User"] = n.PersonID; Response.Redirect("BugsGalore.aspx"); } } } }
Login1_Authenticate(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e) { OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=mydb; User=root;Password=;"); cn.Open(); OdbcCommand cmd = new OdbcCommand("Select * from login where username=? and password=?", cn); //Add parameters to get the username and password cmd.Parameters.Add("@username", OdbcType.VarChar); cmd.Parameters["@username"].Value = this.Login1.UserName; cmd.Parameters.Add("@password", OdbcType.VarChar); cmd.Parameters["@password"].Value = this.Login1.Password; OdbcDataReader dr = default(OdbcDataReader); // Initialise a reader to read the rows from the login table. // If row exists, the login is successful dr = cmd.ExecuteReader(); if (dr.HasRows) { e.Authenticated = true; // Event Authenticate is true } }
protected void ControlLogin_Authenticate(object sender, AuthenticateEventArgs e) { //revisa contra active directory Login_ADWS.AutenticacionUsuariosMAGSoapClient autentificacionWS = new Login_ADWS.AutenticacionUsuariosMAGSoapClient(); try { var resultado = autentificacionWS.verificarUsuarioSenasa(ControlLogin.UserName, ControlLogin.UserName, ControlLogin.Password); using (ServicioGeneral elServicio = new ServicioGeneral()) if (!elServicio.ValidarUsuario(ControlLogin.UserName)) { ControlLogin.FailureText = "El usuario no tiene Privilegios"; return; } else { Session["usuarioCVOuser"]= ControlLogin.UserName; Session["usuarioCVOnombre"] = resultado; Response.Redirect("Consulta.aspx"); } } catch (Exception ex) { ControlLogin.FailureText = "Error de Usuario/Contraseña"; return; } }
protected void Login1_Authenticate(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e) { if (FormsAuthentication.Authenticate(Login1.UserName, Login1.Password)) //if (Membership.ValidateUser(Login1.UserName, Login1.Password)) { e.Authenticated = true; string username = Login1.UserName; bool persist = Login1.RememberMeSet; int timeout = GetLoginTimeout(); string userData = "remoteAddress=" + Request.UserHostAddress; FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, username, DateTime.Now, DateTime.Now.AddMinutes(timeout), persist, userData); string encTicket = FormsAuthentication.Encrypt(ticket); HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket); cookie.Expires = ticket.Expiration; Response.Cookies.Add(cookie); Response.Redirect(FormsAuthentication.GetRedirectUrl(username, persist), true); } else { e.Authenticated = false; } }
//protected void LoginButton_Click(object sender, EventArgs e) //{ // // Validate the user against the Membership framework user store // if (Membership.ValidateUser(UserName.Text, Password.Text)) // { // // Log the user into the site // FormsAuthentication.RedirectFromLoginPage(UserName.Text, RememberMe.Checked); // } // // If we reach here, the user's credentials were invalid // InvalidCredentialsMessage.Visible = true; //} protected void myLogin_Authenticate(object sender, AuthenticateEventArgs e) { // Get the email address entered TextBox EmailTextBox = myLogin.FindControl("Email") as TextBox; string email = EmailTextBox.Text.Trim(); // Verify that the username/password pair is valid if (System.Web.Security.Membership.ValidateUser(myLogin.UserName, myLogin.Password)) { // Username/password are valid, check email MembershipUser usrInfo = System.Web.Security.Membership.GetUser(myLogin.UserName); if (usrInfo != null && string.Compare(usrInfo.Email, email, true) == 0) { // Email matches, the credentials are valid e.Authenticated = true; } else { // Email address is invalid... e.Authenticated = false; } } else { // Username/password are not valid... e.Authenticated = false; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { string userName = this.Login1.UserName; string pwd = this.Login1.Password; // admin login // if (userName == "admin") { if (pwd == "admin") { //WaterUserLevel level = WaterUserLevelFactory.CreateWaterLevel(WaterUserLevelEnum.Ju); ////SessionManager.WaterUserSession.WaterUser = WaterUserFactory.CreateWaterUser(level); //SessionManager.LoginSession.WaterUser = WaterUserFactory.CreateWaterUser(level); e.Authenticated = true; } return; } //int userID, waterUserID; //bool b = UserDBI.CanLogin(userName, pwd, out userID, out waterUserID); ////if (b) ////{ //// LoginSession ls = SessionManager.LoginSession; //// ls.LoginUserName = userName; //// ls.LoginUserID = userID; //// ls.WaterUser = WaterUserFactory.CreateWaterUserByID(waterUserID); ////} //e.Authenticated = b; //Trace.Warn("authenticate : " + b.ToString()); }
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { if (Login1.UserName.Equals("Bryan") && Login1.Password.Equals("1234")) { Server.Transfer("Buypage.aspx"); } }
/// <summary> /// /// </summary> /// <param name="e"></param> protected void ADValidate(AuthenticateEventArgs e) { var domainForValidation = ConfigurationManager.AppSettings["IsHammerTime"] == "True" ? "BOMP" : ConfigurationManager.AppSettings["DomainForValidation"]; using (var pc = new PrincipalContext(ContextType.Domain, domainForValidation)) { //validate the credentials try { var isValid = pc.ValidateCredentials(LoginUser.UserName, LoginUser.Password); if (!isValid) return; Session.Add("credential",LoginUser.Password); e.Authenticated = true; var usuario = GetCredentialFromDb(); if (usuario != null) CreateEncryptedTicket(e, usuario.NombreCompleto); else { LoginUser.FailureText = "El usuario no tiene permisos para acceder a la aplicación."; e.Authenticated = false; } } catch (Exception exception) { LoginUser.FailureText = exception.Message; e.Authenticated = false; } } }
protected void Login_RS_Authenticate(object sender, AuthenticateEventArgs e) { try { sql_cn.Open();//開啟連接 s_sql_query = "SELECT * FROM Member WHERE Member.UserName = @Member_UserName AND Member.Password = @Member_Password";//用來找出登入者是否存在DB的SQL Query sql_cmd = new SqlCommand(s_sql_query, sql_cn);//執行SQL Query的物件 sql_cmd.Parameters.AddWithValue("@Member_UserName", Login_RS.UserName); sql_cmd.Parameters.AddWithValue("@Member_Password", Login_RS.Password); sql_dr = sql_cmd.ExecuteReader();//讀取SQL Query執行結果的物件 e.Authenticated = sql_dr.HasRows;//如果讀到的Row >= 1 身份驗證為true if (e.Authenticated)//身份驗證成功時 儲存使用者MID { sql_dr.Read();//讀取一列資料 Session["MID"] = sql_dr["MID"];//將讀取到的MID存到 Session //Server.Transfer("Home.aspx"); //Response.Redirect("Home.aspx"); Response.Redirect("GridViewTest.aspx"); //Response.Redirect("Rent.aspx"); } sql_cn.Close();//關閉連結 } catch(Exception excp) { Login_RS.FailureText = excp.ToString(); } }
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { Login Login1 = HeadLoginView.FindControl("Login1") as Login; if (Login1 == null) return; if (Login1.UserName.Contains("@")) { string username = Membership.GetUserNameByEmail(Login1.UserName); if (username != null) { if (Membership.ValidateUser(username, Login1.Password)) { Login1.UserName = username; e.Authenticated = true; } else { e.Authenticated = false; } } } else { e.Authenticated = Membership.ValidateUser(Login1.UserName, Login1.Password); } }
protected void Login_Authenticate(object sender, AuthenticateEventArgs e) { SqlCommand com = new SqlCommand("Select * from User_Info", con); SqlDataReader dr; con.Open(); dr = com.ExecuteReader(); while (dr.Read()) { if (Login.UserName == dr["UserID"].ToString() && Login.Password == dr["Password"].ToString()) { DataSet ds = new DataSet(); ds = obj.Data_inventer("select FName from User_Info where UserID='" + Login.UserName + "'"); String name = ds.Tables[0].Rows[0][0].ToString(); Session.Add("name", name); Session.Add("id", Login.UserName); if (Login.UserName.Equals("admin")) { Response.Redirect("~/Pages/AdminProfile.aspx?user="******"~/Pages/Profile.aspx?user=" + Login.UserName); } } dr.Close(); con.Close(); }
protected void loginCtrl_Authenticate(object sender, AuthenticateEventArgs e) { if (ValidateUser(loginCtrl.UserName, loginCtrl.Password)) { // e.Authenticated = true; loginCtrl.Visible = false; Session["IsLogedin"] = true; MemberBO mem = this.MemberService.GetMemberByUserName(loginCtrl.UserName); Session["UserId"] = mem.UserId; mem = this.MemberService.GetMember(mem.UserId); if (string.IsNullOrEmpty(ReturnURL)) { if (mem.RoleName.ToLower() == Constant.USER_ROLE_NAME.ToLower()) { if (mem.Department.Code == Constant.PKD) Response.Redirect("Orders.aspx"); if (mem.Department.Code == Constant.PTK) Response.Redirect("DesignRequests.aspx"); } else { Response.Redirect("Dashboard.aspx"); } } Response.Redirect(ReturnURL); } else { e.Authenticated = false; Session["IsLogedin"] = false; } }
protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e) { if (LoginUser.UserName.Contains("@")) //validação por email { string username = Membership.GetUserNameByEmail(LoginUser.UserName); if (username != null) { if (Membership.ValidateUser(username, LoginUser.Password)) { LoginUser.UserName = username; e.Authenticated = true; } else { e.Authenticated = false; } } } else // validação username normal { if (Membership.ValidateUser(LoginUser.UserName, LoginUser.Password)) e.Authenticated = true; else e.Authenticated = false; } }
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { try { cmd = new SqlCommand("select Email,password from user1 where Email='" + Login1.UserName + "' and password='******'", con); con.Open(); SqlDataReader rd = cmd.ExecuteReader(); while (rd.Read()) { Session["uname"] = rd["Email"].ToString(); } con.Close(); if (Session == null) { } else { updatepage(); Response.Redirect("Status.aspx"); } } catch (Exception ff) { // Label1.Text = "There is some problem in server"; con.Close(); } }
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { HttpCookie cookie = new HttpCookie("ejas_login"); SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["globaldb"].ConnectionString); string q1 = "SELECT * FROM login_v WHERE username='******' and password="******"role"].ToString().ToLower().Equals("admin")) Session["adminid"]= Convert.ToInt32(rdr["UserID"]); cookie["username"] = (rdr["Username"].ToString()); cookie["userid"] = rdr["UserID"].ToString(); } Response.Cookies.Add(cookie); con1.Close(); if(Login1.RememberMeSet) cookie.Expires = DateTime.Now.AddDays(365); Response.Cookies.Add(cookie); btnLoginb.Text = "Logout"; lblHelloText.Text = "Hello " + cookie["username"]; Login1.Visible = false; //if (Convert.ToInt32(Session["adminid"])>0) // Response.Redirect("~/cpanelPages/ControlPanel.aspx"); }
protected void ValidateUser(object sender, AuthenticateEventArgs e) { Billcmd = new SqlCommand(); Billcon = new SqlConnection(ConfigurationManager.ConnectionStrings["BillingConnectionString2"].ToString()); Billcmd.Connection = Billcon; Billcmd.CommandText = "select * from myusers where Name=@pName and Password=@pPassword"; Billcmd.CommandType = CommandType.Text; Billcmd.Parameters.Add("@pName", SqlDbType.NVarChar).Value = Login1.UserName; Billcmd.Parameters.Add("@pPassword", SqlDbType.NVarChar).Value = Login1.Password; Billcon.Open(); try { SqlDataReader reader = Billcmd.ExecuteReader(); if (reader.Read()) { Session["Name"] = reader["Name"].ToString(); Session["Role"] = reader["Role"].ToString(); String s=Session["Role"].ToString(); } Billcon.Close(); } catch(Exception r){ Response.Redirect("test.aspx"); } Response.Redirect("Stock_Master.aspx"); }
protected void aw_login_Authenticate(object sender, AuthenticateEventArgs e) { SqlConnection con = new SqlConnection(connection); SqlCommand cmd = new SqlCommand("spAuthenticateUser", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@email", aw_login.UserName); cmd.Parameters.AddWithValue("@password", aw_login.Password); con.Open(); //SqlDataReader dr = cmd.ExecuteReader(); int value = Convert.ToInt32(cmd.ExecuteScalar()); if (value == 1) { string sqlquery = "select CustomerID from [SalesLT].[Customer] where EmailAddress = '" + aw_login.UserName + "' "; SqlCommand cmd1 = new SqlCommand(sqlquery, con); int CustomerID = Convert.ToInt32(cmd1.ExecuteScalar()); Session["customerid"] = CustomerID; //// Dictionary<int, int> cartItems = new Dictionary<int, int>(); Session["ShoppingCart"] = cartItems; FormsAuthentication.RedirectFromLoginPage(aw_login.UserName, false); } con.Close(); }
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { Session["password"] = Login1.Password; Session["userName"] = Login1.UserName; Server.Transfer("PassPhrase.aspx"); }
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { if (Login1.Password.Equals("dcwj")&&Login1.UserName.Equals("admin")) { Response.Redirect("index.aspx"); } }
protected void lgnLogin_Authenticate(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e) { #region IniciarSesion con directorio activo try { Login loLogin = (Login)sender; TextBox txtDominio = (TextBox)loLogin.FindControl("Domain"); PrincipalContext loLDAP = new PrincipalContext(ContextType.Domain, txtDominio.Text, loLogin.UserName, loLogin.Password); Dapesa.Comun.DirectorioActivo.Reglas.Usuario loUsuario = new Dapesa.Comun.DirectorioActivo.Reglas.Usuario(); Cifrado loCifrado = new Cifrado(Dapesa.Criptografia.Comun.Definiciones.TipoCifrado.AES); Sesion loSesion = new Sesion() { Conexion = new Conexion() { Nombre = loLDAP.Name, Servidor = loLDAP.ConnectedServer, Credenciales = new Credenciales() { Cifrado = loCifrado, Contrasenia = loCifrado.Cifrar(loLogin.Password), Usuario = loLogin.UserName }, }, Estatus = (loLDAP.ValidateCredentials(loLogin.UserName, loLogin.Password)) ? Dapesa.Seguridad.Comun.Definiciones.EstatusSesion.Iniciada : Dapesa.Seguridad.Comun.Definiciones.EstatusSesion.NoIniciada, Usuario = new Usuario() { Estatus = Dapesa.Seguridad.Comun.Definiciones.EstatusUsuario.Valido, Sucursal = new List <Sucursal>() { new Sucursal() } }, }; e.Authenticated = loSesion.Estatus == Dapesa.Seguridad.Comun.Definiciones.EstatusSesion.Iniciada && loUsuario.PerteneceA(loSesion, ConfigurationManager.AppSettings["GrupoValidez"]); if (e.Authenticated) { loSesion.Usuario.Nombre = loUsuario.ObtenerPropiedad(loSesion, "name"); loSesion.Usuario.Sucursal[0].Descripcion = loUsuario.ObtenerPropiedad(loSesion, "l"); SesionDB(); } Session["Sesion"] = loSesion; } catch (Exception) { e.Authenticated = false; } #endregion }
protected void LoginUser_Authenticate(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e) { string userName = LoginUser.UserName; string password = LoginUser.Password; bool result = UserLogin(userName, password); if ((result)) { e.Authenticated = true; } else { e.Authenticated = false; } }
protected void ValidateUser(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e) { string userName = login.UserName; string password = login.Password; bool result = dblogin(userName, password); if ((result)) { e.Authenticated = true; Response.Redirect("normal.html"); } else { e.Authenticated = false; } }
protected void ValidateUser(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e) { string userName = Login1.UserName; string password = Login1.Password; bool result = UserLogin(userName, password); if ((result)) { if (result == true) { using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "SELECT Username FROM UserActivation WHERE Username ='******';"; cmd.Connection = conn; using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) { DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows.Count > 0) // Check if the DataTable returns any data from database { string myStringVariable = "Account has not been activated."; ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + myStringVariable + "');", true); } else { e.Authenticated = true; Session["userName"] = Login1.UserName; FormsAuthentication.RedirectFromLoginPage(Login1.UserName, false); //Response.Redirect("Default.aspx"); } } } } else { e.Authenticated = false; string myStringVariable = "Invalid username or password"; ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + myStringVariable + "');", true); } } }
protected void CreateLoginAudit(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e) { TextBox txtimgcode1 = (TextBox)LoginUser.FindControl("txtimgcode"); HiddenField hdnCaptcha = (HiddenField)LoginUser.FindControl("hdnCaptcha"); if (txtimgcode1.Text == RemoveSpace(hdnCaptcha.Value.Trim().ToString())) { TextBox _Username = (TextBox)LoginUser.FindControl("UserName"); TextBox _Password = (TextBox)LoginUser.FindControl("Password"); MembershipUser user = Membership.GetUser(_Username.Text); if (user != null) { string strPassword = string.Empty; OBJloginSchema.UserName = _Username.Text; strPassword = ObjLoginBL.GetUserPassword(OBJloginSchema); //Added Mahesh Patel on 27-12-2018 int ldmDistrictId = 0; ldmDistrictId = ObjLoginBL.GetUserPasswordLDM(OBJloginSchema); if ((CopmpareRandnoPwd(strPassword) == _Password.Text)) { string strAuthToken = Guid.NewGuid().ToString(); HttpContext.Current.Profile.SetPropertyValue("AuthToken", strAuthToken); Response.Cookies.Add(new HttpCookie("AuthToken", strAuthToken)); e.Authenticated = true; Session["AuthToken"] = strAuthToken; Session["User"] = _Username; Session["LDM_DistrictId"] = ldmDistrictId; } else { txtimgcode1.Text = string.Empty; } } } else { txtimgcode1.Text = string.Empty; ScriptManager.RegisterStartupScript(this, typeof(Page), "Message", "alert('Incorrect Captcha Value !! Try again.');", true); } }
protected void Login1_Authenticate(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e) { string clientIp = Request.ServerVariables.Get("Remote_Addr").ToString(); if (true)//this.Login1.UserName=="ZHANGYINGCHUN"||(clientIp.Length > 7 && (clientIp.Substring(0, 7) == "203.169"||clientIp.Substring(0, 3) == "192"||clientIp.Substring(0,3) == "218"||clientIp.Substring(0,3) == "127"||clientIp.Substring(0,3) == "175"))) { if (this.Login1.RememberMeSet) { if (Request.Browser.Cookies) { if (Request.Cookies["C2_LOGIN_INFO"] == null) { Response.Cookies["C2_LOGIN_INFO"].Expires = DateTime.Now.AddDays(30); Response.Cookies["C2_LOGIN_INFO"]["LOGIN_ID"] = this.Login1.UserName; Response.Write(string.Format("<!-- new login as : [{0}]-->", Response.Cookies["C2_LOGIN_INFO"]["LOGIN_ID"])); } else { Response.Cookies["C2_LOGIN_INFO"]["LOGIN_ID"] = this.Login1.UserName; Response.Write(string.Format("<!-- exist login as : [{0}]-->", Response.Cookies["C2_LOGIN_INFO"]["LOGIN_ID"])); } } } C2.Membership membership = new C2.Membership(); if (membership.ValidateUser(this.Login1.UserName, this.Login1.Password)) { System.Web.Security.FormsAuthentication.RedirectFromLoginPage(this.Login1.UserName.ToUpper(), this.Login1.RememberMeSet); } } else { // will login database later System.IO.StreamWriter w = new System.IO.StreamWriter(Server.MapPath("~/App_data/Login.txt"), true); w.WriteLine(DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss") + " IP:" + clientIp + " UserName:" + this.Login1.UserName); w.Close(); } }
protected void LoginUser_Authenticate(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e) { try { //obtine el nombre del usuario que desea autenticarse string name = LoginUser.UserName; //Obtine el password string password = LoginUser.Password; //obtiene si el usuario desea o no almacenar una cookie bool checkcookie = LoginUser.RememberMeSet; Users user = new Users(); user = loadUser(name); if (user != null) { bool ValIngreso = true; if (user._usv_flg_Expired == "A") { if (user._usv_status == Constants.IdStatusPasswordExpiration) { ValIngreso = false; } } if (user._usu_est_id.Equals(Constants.IdStatusActive) && ValIngreso) { //Desencripta la contraseña del usuario string passUser = Cryptographic.decrypt(user._usu_contraseña); //valida la contraseña contraseña que ingreso contra lad del usuario if (password.Equals(passUser)) { //userSign(ref user, name, password, Request.UserHostAddress); Session[Constants.NameSessionUser] = user; loadMenu(user._bas_id); //String ip = GetUserIPAddress(); // o se puede utiliar lo siguiente que es lo mismo string _host = ""; string _ip = ""; GetIpAddress(ref _host, ref _ip); //insertar log de acceso al sistema Log_Transaction._auditoria_acceso(user._bas_id, user._nombre, _ip, _host); //Autenticación try { FormsAuthentication.RedirectFromLoginPage(user._bas_id.ToString(), checkcookie); } catch (Exception ex) { LoginUser.FailureText = "Error de conexión: " + ex.Message.ToString(); } } else { InvalidCredentialsLog.insertInvalidCredentialsLog(user._usv_co, name, password, "F", "F", Request.UserHostAddress); System.Diagnostics.Trace.WriteLine("[ValidateUser] Usuario y/o contraseña invalidos."); } } else if (user._usv_status.Equals(Constants.IdStatusPasswordExpiration) && user._usv_flg_Expired == "A") { //Desencripta la contraseña del usuario string passUser = Cryptographic.decrypt(user._usu_contraseña); //valida la contraseña contraseña que ingreso contra lad del usuario if (password.Equals(passUser)) { userSign(ref user, name, password, Request.UserHostAddress); loadMenu(user._bas_id); FormsAuthentication.SetAuthCookie(user._usn_userid.ToString(), checkcookie); Server.Transfer("changePassword.aspx?expiration=1"); } else { InvalidCredentialsLog.insertInvalidCredentialsLog(user._usv_co, name, password, "F", "F", Request.UserHostAddress); System.Diagnostics.Trace.WriteLine("[ValidateUser] Usuario y/o contraseña invalidos."); } } else { LoginUser.FailureText = "Error de conexión: El usuario no esta Activo"; } } else { System.Diagnostics.Trace.WriteLine("[ValidateUser] La validacion del usuario fallo."); } } catch (Exception ex) { } }
protected void Login1_Authenticate(object sender, System.Web.UI.WebControls.AuthenticateEventArgs e) { bool isBypass = false; ActivityLog log = new ActivityLog(); ActivityLogBll logBll = new ActivityLogBll(); string host = Request.UserHostName; string ipaddress = Request.UserHostAddress; if (String.IsNullOrEmpty(ipaddress)) { ipaddress = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; } log.HostName = host; log.IPAddress = ipaddress; log.Action = "Login"; try { wcf_auth.AuthenticateUserClient myClient = new wcf_auth.AuthenticateUserClient(); wcf_auth.ResponseUsersData myResponse = new wcf_auth.ResponseUsersData(); var form = (System.Web.UI.WebControls.Login)sender; var x = Page; string userName = ((DevExpress.Web.ASPxEditors.ASPxTextBox)form.FindControl("UserName")).Text.Trim(); string password = ((DevExpress.Web.ASPxEditors.ASPxTextBox)form.FindControl("Password")).Text.Trim(); var selected = ((DevExpress.Web.ASPxEditors.ASPxComboBox)form.FindControl("cbbDomain")).SelectedItem.Value.ToString().Split(';'); myResponse = myClient.AuthenticateUserAD(selected[0], selected[1], "pkbl", userName, password); if (myResponse.ResponseMessage.Type == "S" || isBypass) { string Uname; if (!isBypass) { log.UserName = userName; log.Type = "S"; log.Description = "Login Sukses dengan id" + ' ' + userName; Uname = myResponse.UserPropertiesList.mUserName; //log.HostName=; } else { Uname = "bypass"; log.UserName = Uname; log.Type = "S"; log.Description = "Login bypass dengan id" + ' ' + Uname; } Session["user"] = Uname; Session["userprofile"] = myResponse.UserPropertiesList; FormsAuthentication.RedirectFromLoginPage(Uname, false); DataTable dt = new DataTable(); dt.Columns.Add("job"); myResponse.UserPropertiesList.mAuthObjectValueList.Where(t => t.mAuthObjectName == "JOBPOSITION").ToList().ForEach(t => dt.Rows.Add(new object[] { t.Value1 })); //set cbb datasource } else { log.UserName = userName; log.Type = "F"; log.Description = "Login Gagal dengan id " + ' ' + userName; //logBll.InsertActivity(log); } } catch (Exception ex) { log.Type = "E"; log.Description = "error : " + ex.Message; } finally { logBll.InsertActivity(log); } }
protected virtual new void OnAuthenticate(AuthenticateEventArgs e) { }
/// <summary> /// Autenticación de control de usuario de Login. /// </summary> protected void ucLogin_Authenticate(Object sender, System.Web.UI.WebControls.AuthenticateEventArgs e) { List <mSession> Sesiones = Application["Sessions"] as List <mSession>; mSession SesionUsuario = null; try { string strMensaje = ""; //Validaciones básicas. if (!ValidarDatos(ref strMensaje)) { //Fallaron validaciones básicas. ucLogin.FailureText = strMensaje; e.Authenticated = false; return; } cFormLogin objFormLogin = new cFormLogin(); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Control de login de usuarios bool blnValidarSesion = DatosSesion.Control.Verificar(ucLogin.UserName, Sesiones, out strMensaje); if (!blnValidarSesion) { ucLogin.FailureText = strMensaje; e.Authenticated = false; return; } DatosSesion.Control.Guardar(ucLogin.UserName, Sesiones, Session, ref SesionUsuario); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //Autentica el usuario. string ip = hdnIP.Value.ToString(); //[GonzaloP] [miércoles, 22 de febrero de 2017] Work-Item: 9131 bool LoginSSO = false; //Si el usuario no es "master" entonces se valida si está habilitado el logueo por SSO. if (ucLogin.UserName != "master") { string strURL_SSO = System.Configuration.ConfigurationManager.AppSettings["ServicioValidacionToken"]; if (!String.IsNullOrWhiteSpace(strURL_SSO.Trim())) { LoginSSO = true; } } //Sólo el usuario "master" puede acceder directamente a CIPOL cuando está habilitado el logueo por SSO. if (!LoginSSO) { if (!objFormLogin.AutenticarUsuario(ref strMensaje, ucLogin.UserName, ucLogin.Password, new System.Net.CookieContainer(), ip)) { //Falló autenticación. ucLogin.FailureText = strMensaje; e.Authenticated = false; DatosSesion.Control.Eliminar(Sesiones, SesionUsuario); return; } //Validar Dominio if (ManejoSesion.DatosCIPOLSesion.DatosPadreCIPOLCliente.IDUsuario.Equals(0)) { if (ManejoSesion.DatosCIPOLSesion.DatosPadreCIPOLCliente.NombreDominio.Equals("X")) { //Abrir Administrar Tipo de Seguridad. Response.Redirect("frmTipoSeguridad.aspx?CambiarDominio=false"); e.Authenticated = false; DatosSesion.Control.Eliminar(Sesiones, SesionUsuario); return; } } else { if (ManejoSesion.DatosCIPOLSesion.DatosPadreCIPOLCliente.NombreDominio == null || ManejoSesion.DatosCIPOLSesion.DatosPadreCIPOLCliente.NombreDominio == Constantes.SeguridadNODefinida) { ucLogin.FailureText = "No existe un tipo de seguridad establecido, imposible iniciar la aplicación."; e.Authenticated = false; DatosSesion.Control.Eliminar(Sesiones, SesionUsuario); return; } } //Redirecciona a la página que obliga a cambiar clave if (ManejoSesion.DatosCIPOLSesion.DatosPadreCIPOLCliente.OtrosDatos("ForzarCambioClave") == "1") { try { if (ManejoSesion.DatosCIPOLSesion.DatosPadreCIPOLCliente.OtrosDatos("ForzarCambioClave.SeDebePreguntar") == "1") { /// 1 No obligatorio ManejoSesion.ModoCambioClave = 1; e.Authenticated = true; DatosSesion.Control.Eliminar(Sesiones, SesionUsuario); return; } } catch (Exception) { } /// 3 Obligatorio debido a que se debe forzar el cambio de la contraseña ManejoSesion.ModoCambioClave = 3; //[GonzaloP] [viernes, 22 de julio de 2016] Work-Item: 7289 - Se agrega el parámetro "true" para terminar la ejecución de la página actual. Response.Redirect("ChangedPassword\\frmCambiarContrasenia.aspx?url=../frmLogin.aspx", true); e.Authenticated = false; DatosSesion.Control.Eliminar(Sesiones, SesionUsuario); return; } e.Authenticated = true; } else { ucLogin.FailureText = "Se encuentra habilitado el logueo por SSO. No se permite el acceso directo a CIPOL."; e.Authenticated = false; DatosSesion.Control.Eliminar(Sesiones, SesionUsuario); return; } } catch (Exception ex) { ucLogin.FailureText = ex.Message; e.Authenticated = false; DatosSesion.Control.Eliminar(Sesiones, SesionUsuario); } }