protected void btnLogin_Click(object sender, EventArgs e)
        {

            this.lblMessage.Text = "";

            string userName = this.txtUserID.Text;

            MyPrincipal principal;

            HttpContext.Current.Session.Clear();

            UserComponent uc = new UserComponent();

            if (uc.VerifyPassword(userName, txtPassword.Text))
            {


                principal = new MyPrincipal(userName);

                System.Threading.Thread.CurrentPrincipal = principal;

                HttpContext.Current.Session["JMPrincipal"] = principal;

                HttpContext.Current.User = (MyPrincipal)(HttpContext.Current.Session["JMPrincipal"]);

                try
                {
                    //登陆系统
                    Page.Response.Redirect("Main.aspx");

                    //string url = FormsAuthentication.GetRedirectUrl(userName, true);

                    //Response.Redirect(url);
                    //FormsAuthentication.RedirectFromLoginPage(userName, false);

                }
                catch (Exception ex)
                {
                    throw ex;
                }

                
            }
            else
            {
                this.txtPassword.Text = "";
                this.txtUserID.Text = "";

                this.lblMessage.Text = "用户名或密码输入错误!";

            }
        }
        public static MyPrincipal ValidateLogin(string LoginName, string Password)
        {
            MyPrincipal prin = new MyPrincipal(LoginName);

            if (prin.Identity == null)
            {
                return null;
            }

            if (((MyIdentity)prin.Identity).checkPassword(Password))
            {
                return prin;
            }
            else
            {
                return null;
            }

        }