示例#1
0
    protected void LogIn(object sender, EventArgs e)
    {
        try
            {
                AppUser user = new AppUser();
                user.AppUserId = txtUserName.Text.Trim();
                user.AppUserPassword = txtPassword.Text.Trim();

                if (user.UserCredentialsAreValid())
                {
                    Session["AppUser"] = user;
                    Response.Redirect("../Default.aspx");
                }
                else
                {
                    titleLabel.Visible = true;
                    titleLabel.InnerText = user.StatusDescription;
                }
            }
            catch (Exception ex)
            {
                titleLabel.Visible = true;
                titleLabel.InnerText = ex.Message;
            }
    }