예제 #1
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            account_WCFLib.LoginClient acnt_proxy = new account_WCFLib.LoginClient();
            string[] res = acnt_proxy.userLogin(txtUsername.Text.Trim(), txtPassword.Text.Trim());

            if (res[0] != "NA")
            {
                //Session or authentication logic

                Session["userId"]   = res[1];
                Session["userName"] = txtUsername.Text.Trim();
                if (res[0] == "Stu")     //Go to the Student Index
                {
                    Session["role"] = "Student";
                    Response.Redirect("~/Students/default.aspx");
                }
                else if (res[0] == "Prof")
                {
                    Session["role1"] = "Professor";
                    Response.Redirect("~/Professors/default.aspx");
                }
                //Verfication reply has to redirect
            }
            else
            {
                lblError.Text = "Please enter correct password";
            }
        }
        protected void btnVerification_Click(object sender, EventArgs e)
        {
            bool role = false;

            if (Prof.Checked)
            {
                role = true;
            }
            else if (Stu.Checked)
            {
                role = false;
            }
            account_WCFLib.LoginClient acnt = new account_WCFLib.LoginClient();
            string s = acnt.accountVerification(txtEmail.Value, txtVerification.Text, role);

            if (s == "1")
            {
                //Login logic of cookie or session
            }
            else
            {
                lblError.Visible = true;
            }
        }