protected void Button1_Click(object sender, EventArgs e)
        {
            if (pwd.Text.Equals(cnf.Text))
            {
                Hashing hash = new Hashing();
                String hashpwd = hash.createHash(pwd.Text);
                List<String> details = new List<String>();
                details.Add(un.Text);
                details.Add(hashpwd);
                details.Add(email.Text);
                XMLManipulator man = new XMLManipulator();
                Boolean flag = man.saveToXML(details, true);
                if (flag == false)
                {
                    msg.Text = "username aleady exists";
                }
                else { msg.Text = "Registered";
                Response.Redirect("Login.aspx");
                }
            }

            else
            {
                msg.Text = "passwords are not same";
            }
        }
        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";
        }
예제 #3
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";
          }
          }
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (pwd.Text.Equals(cnf.Text))
            {
                Hashing hash = new Hashing();
                String hashpwd = hash.createHash(pwd.Text);
                List<String> details = new List<String>();
                details.Add(un.Text);
                details.Add(hashpwd);
                details.Add(email.Text);
                XMLManipulator man = new XMLManipulator();
               Boolean flag = man.saveToXML(details,false);
               if (flag == false) {
                   msg.Text= "username aleady exists";}
                   else{
                       HttpCookie myCookies = new HttpCookie("myCookieId");
                       myCookies["NameUser"] = un.Text;
                       myCookies.Expires = DateTime.Now.AddMonths(6);
                       Response.Cookies.Add(myCookies);
                       msg.Text = "Name stored in cookiesis registered = "  + myCookies["NameUser"] ;

                   }
               }
            
            else {
                msg.Text = "passwords are not same";
            }
        }
예제 #5
0
 protected void Button3_Click(object sender, EventArgs e)
 {
     Hashing hash = new Hashing();
     String hashpwd = hash.createHash(pwd.Text);
     Label1.Text = hashpwd;
 }