示例#1
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        String username = TextBox1.Text;
        String password = TextBox2.Text;

        Class1 obj       = new Class1();
        String encrypted = obj.Encrypt(password);

        //  LoginAndSignUp.Service1Client login = new LoginAndSignUp.Service1Client();
        // Login.Service1Client login = new Login.Service1Client();
        SignUpAndAddressService.Service1Client login = new SignUpAndAddressService.Service1Client();
        bool result = login.Login(username, encrypted);
        // bool result = login.Login(username, password);

        HttpCookie myCookies = new HttpCookie("myCookieId");

        myCookies["UserName"] = TextBox1.Text;
        myCookies.Expires     = DateTime.Now.AddDays(20);
        Response.Cookies.Add(myCookies);

        if (result)
        {
            // Response.Redirect("AddToCart_Final.aspx");
            FormsAuthentication.RedirectFromLoginPage(TextBox1.Text, false);
        }
        else
        {
            Label3.Text = "Please Check The credentials ";
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //We take the input from the user and store it in the xml file.
        if (Session["genstr"].ToString() == TextBox4.Text)
        {
            String username  = TextBox1.Text;
            String password  = TextBox2.Text;
            Class1 obj       = new Class1();
            String encrypted = obj.Encrypt(password);
            string address   = TextBox3.Text;
            SignUpAndAddressService.Service1Client signup = new SignUpAndAddressService.Service1Client();

            bool verify = signup.Login(username, encrypted);
            if (!verify)
            {
                // LoginAndSignUp.Service1Client login = new LoginAndSignUp.Service1Client();
                signup.SignUp(username, password, address);
                Label3.Text = "You have signed up";
            }
            else
            {
                Label3.Text = "You have already signed up";
            }
        }
        else
        {
            Label3.Text = "not match";
        }
    }