protected void Button1_Click(object sender, EventArgs e)
        {
            if (TextBox1.Text == "admin")
            {
                Hashing hash = new Hashing();
                String hashpwd = hash.createHash(TextBox2.Text);
                XMLManipulator man = new XMLManipulator();
                Boolean flag = man.authenticateUser(TextBox1.Text, hashpwd,false);

                if (flag == true)
                {
                    HttpCookie myCookies = new HttpCookie("myCookieId");
                    myCookies["StaffName2"] = TextBox1.Text;
                    myCookies.Expires = DateTime.Now.AddMonths(6);
                    Response.Cookies.Add(myCookies);
                   

                    Session["StaffName2"] = TextBox1.Text;

                    Session["flag"] = "true";
                    Response.Redirect("StaffSignUp.aspx");  // Return to catalog page
                    
                }
                else
                {
                    Label1.Text = "Invalid Password";
                }


            }
            else Label1.Text = "invalid user";
        }
Ejemplo n.º 2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Hashing hash = new Hashing();
            String hashpwd= hash.createHash(pwd.Text);
            XMLManipulator man = new XMLManipulator();
          Boolean flag =  man.authenticateUser(un.Text, hashpwd,true);

          if (flag == true)
          {
              HttpCookie myCookies = new HttpCookie("myCookieId");
              myCookies["Name"] = un.Text;
              Session["name"] = un.Text;
              myCookies.Expires = DateTime.Now.AddMonths(6);
              Response.Cookies.Add(myCookies);
              unlabel.Text = "Name stored in cookies " + myCookies["Name"];

              Login.usern = un.Text;

             
              Session["flag"] = "true";
              Response.Redirect("MemberPage.aspx");  // Return to catalog page

          }
          else {
              unlabel.Text = "Invalid Username or Password";
          }
          }