コード例 #1
0
 protected void btn_register_Click(object sender, EventArgs e)
 {
     //save to xml file --> using our service
     try
     {
         UserRegistrationService.Service1Client client = new UserRegistrationService.Service1Client();
         Boolean response = client.registerUser(UserInput.Text, Class1.Encrypt(PasswordInput.Text));  // Adding the user by manipulating XML file
         if (response.Equals(true))
         {
             //  Error.Text = "User has been registered Successfully!";
             Session["registration"] = "success";
             Response.Redirect("MemberLogin.aspx");
         }
         else if (response.Equals(false))
         {
             Error.Text = "Username already exist! Provide a new username";
         }
         else
         {
             Error.Text = "Username or password is incorrect!!";
             //Error.Text = response;
         }
         //}
     }
     catch (Exception e1)
     {
         Error.Text = e1.Message;
     }
 }
コード例 #2
0
    protected void btn_register_user_Click(object sender, EventArgs e)
    {
        UserRegistrationService.Service1Client proxy = new UserRegistrationService.Service1Client();

        //Ensure entry not null
        if (!String.IsNullOrWhiteSpace(txt_register_username.Text) && !String.IsNullOrWhiteSpace(txt_register_userpass.Text))
        {
            //Call the operation to register
            Boolean created = proxy.registerUser(txt_register_username.Text, Class1.Encrypt(txt_register_userpass.Text));

            //Set label to the apt response
            if (created)
            {
                Label1.Text      = "User successfully Registered in Member.xml!";
                Label1.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                Label1.Text      = "User already registered in Member.xml!";
                Label1.ForeColor = System.Drawing.Color.Red;
            }
        }
        else
        {
            Label1.Text      = "Enter Valid Username and password!";
            Label1.ForeColor = System.Drawing.Color.Red;
        }
    }