Example #1
0
    //用户登录
    protected void btnCheck_Click()
    {
        U_UserNameBU user1  = new U_UserNameBU();
        bool         login1 = user1.Login(this.username.Text.Trim(), this.password.Text.Trim());

        user1.Close();
        if (login1 == false)
        {
            Util.alert(this.Page, "提示:用户名或密码不正确!");
        }
        else
        {
            Hashtable ht = (Hashtable)Application["OnLineUser"];
            ht[this.username.Text.Trim()] = this.username.Text.Trim();

            System.Web.Security.FormsAuthentication.SetAuthCookie(this.username.Text.Trim(), false);
            //FormsAuthentication.RedirectFromLoginPage(this.username.Text.Trim(), false);

            //写入用户登录日志(管理员忽略不写)
            if (this.username.Text.Trim() != "admin")
            {
                XT_UserLogBU logo1 = new XT_UserLogBU();
                logo1.AddLogo(this.username.Text.Trim());
                logo1.Close();
            }

            this.WirteLoginInfo(this.username.Text.Trim());


            //调整错误的数据
            this.RestoreErrorData();

            //进行数据的转向处理
            if (this.db.SelectedIndex == 0)  //转老资产管理数据库
            {
                Response.Redirect("~/zcdbWeb/default.aspx", true);
            }
            else                             //转联想资产管理数据库
            {
            }
        }
    }
Example #2
0
    //用户登录
    protected void btnCheck_Click()
    {
        U_UserNameBU user1  = new U_UserNameBU();
        bool         login1 = user1.Login(this.username.Text.Trim(), this.password.Text.Trim());

        user1.Close();
        if (login1 == false)
        {
            Util.alert(this.Page, "提示:用户名或密码不正确!");
        }
        else
        {
            Hashtable ht = (Hashtable)Application["OnLineUser"];
            ht[this.username.Text.Trim()] = this.username.Text.Trim();

            //System.Web.Security.FormsAuthentication.SetAuthCookie(this.username.Text.Trim(), false);
            //FormsAuthentication.RedirectFromLoginPage(this.username.Text.Trim(), false);

            //设置登录信息
            //建立身份验证票对象
            FormsAuthenticationTicket Ticket = new FormsAuthenticationTicket(1, this.username.Text,
                                                                             DateTime.Now, DateTime.Today.AddDays(1), true, this.username.Text, "/");

            string     HashTicket = FormsAuthentication.Encrypt(Ticket); //加密序列化验证票为字符串
            HttpCookie UserCookie = new HttpCookie(FormsAuthentication.FormsCookieName, HashTicket);
            Response.Cookies.Add(UserCookie);                            //输出Cookie



            //写入用户登录日志(管理员忽略不写)
            if (this.username.Text.Trim() != "admin")
            {
                XT_UserLogBU logo1 = new XT_UserLogBU();
                logo1.AddLogo(this.username.Text.Trim());
                logo1.Close();
            }

            if (this.chk1.Checked)
            {
                WebFrame.Util.JCookie.SetCookieValue("myPassWord", this.password.Text);
            }
            else
            {
                WebFrame.Util.JCookie.SetCookieValue("myPassWord", "");
            }

            this.WirteLoginInfo(this.username.Text.Trim());


            //调整错误的数据
            this.RestoreErrorData();

            //进行数据的转向处理
            if (this.db.SelectedIndex == 0)  //转老资产管理数据库
            {
                Response.Redirect("default0.aspx", true);
            }
            else                             //转汉口银行资产管理数据库
            {
                String url1 = ConfigurationManager.AppSettings["hkbankurl"];
                url1 = url1 + Server.UrlEncode(this.username.Text);
                Response.Redirect(url1, true);
            }
        }
    }