protected void AccountCreationButton_Click(object sender, EventArgs e) { var users = new UserDB(Server.MapPath("Config/") + @"Users.txt"); if (!users.UserExists(AccountCreationUserName.Text)) { UserAccount newUser = new UserAccount { userName = AccountCreationUserName.Text, email = AccountCreationEmail.Text, password = AccountCreationPassword.Text, funds = 0, status = 1 }; users.Adduser(newUser); users.Save(); Session["CurrentUser"] = newUser; Response.Redirect("Dashboard.aspx"); } else { //User already exists } }