protected void encryptBtn_Click(object sender, EventArgs e) { //init new encryption object from StringEncryptDecrpy .dll file StringEncryptDecrypt.Encryption encryption = new StringEncryptDecrypt.Encryption(); //encrypt the string and display it encryptedLbl.Text = encryption.Encrypt(encryptStringInput.Value); }
protected void RegisterBtn_Click(object sender, EventArgs e) { //first make sure passwords match if (passwordInput.Value != confirmPasswordInput.Value) { messageLbl.Text = "Passwords do not match"; return; } else { //init new encryption object using Encryption .dll file StringEncryptDecrypt.Encryption encryption = new StringEncryptDecrypt.Encryption(); //we need to register the username and password within Members.xml //get path for Members.xml file string path = AppDomain.CurrentDomain.BaseDirectory; path += "App_Data\\Members.xml"; //store to App_Data folder on server? //open the Members.xml file XDocument doc = XDocument.Load(path); XElement root = doc.Element("root"); XElement members = root.Element("Members"); members.Add(new XElement("Member", new XAttribute("username", usernameInput.Value), //encrypt the password using StringEncryptDecrypt .dll file new XAttribute("password", encryption.Encrypt(passwordInput.Value)))); //save the new member to the xml file doc.Save(path); //redirect to login page Response.Redirect("~/Login.aspx"); } }