Пример #1
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        String user = txtUsername.Text;
        String pass = txtPassword.Text;

        if (user != null && pass != null)
        {
            UserInfoModel   model = new UserInfoModel();
            UserInformation info  = new UserInformation();
            info = model.GetUserInfoByUserName(user);

            if (info != null)
            {
                if (info.Password == pass && info.IsVerified)
                {
                    Session["id"]   = info.GUID;
                    Session["role"] = "user";
                    Response.Redirect("~/Pages/Index.aspx");
                }
                else
                {
                    litStatus.Text = "Invalid Password";
                }
            }
            else
            {
                litStatus.Text = "Invalid Username";
            }
        }
        else
        {
            litStatus.Text = "Enter user name";
        }
    }