示例#1
0
        /* Button login click event */
        void LoginButton_Click(object sender, EventArgs e)
        {
            System.Web.UI.Page page = (System.Web.UI.Page)HttpContext.Current.Handler;

            string user = ((TextBox)page.FindControl("tbUser")).Text;
            string pass = ((TextBox)page.FindControl("tbPass")).Text;

            DbConfig.db_config_users dcu = new DbConfig.db_config_users(user);
            dcu.Open();

            DbConfig.UserLoginData uld = dcu.IsUserAuthenticated(pass);

            if (uld != null)
            {
                DbConfig.db_config_sessions.SetUserAuthentication(uld);

                Generic.PageRefresh();
            }
            else
                Generic.JavaScriptInjector("loginFail", "alert('login failed')");
        }