I have a website that takes an email, runs a powershell script, gets the output from that script and dynamically creates buttons based on that output. My trouble is that when you hit the back button and go through it again, the old button(s) still remain, and still dynamically create more buttons on top of that, resulting in duplicate buttons, and users from on email address accessing results from other email addresses.

I cannot, however, figure out how to get rid of the button once the page changes. 
I have tried creating the buttons dynamically into a panel instead but Panel.Clear is not working for me either, nor is Panel.Dispose or Form.Dispose.

Here's the flow of the site:
WebForm1>Accounts(in code WebForm4)>WebForm2>WebForm3

Page 2 C#:

```
namespace ActiveDirectoryReset
{
public partial class WebForm4 : System.Web.UI.Page
{
    public static string user; //this comes from what is returned by first 
page
    public static string toEmail; //email from previous page
    public static string key; //irrelevant

    protected void Page_Load(object sender, EventArgs e)
    {

        int id = 1;
        int eventid = 0;

        //makes happy little buttons for each account associated with email 
provided//

        System.Web.UI.HtmlControls.HtmlForm form = form1;

        Controls.Add(form);

        foreach (var account in WebForm1.accounts)
            {

                eventid = id;
                id++;

                System.Web.UI.WebControls.Button button = new System.Web.UI.WebControls.Button();

                button.ID = "btn" + eventid;
                button.CssClass = "button";
                button.Click += new EventHandler(this.selectUser);
                button.Text = account;

                button.Font.Name = "Segoe UI";

                form.Controls.Add(button);

            }

    }
    //called after user is selected (dynamically created button is clicked)//

    public void selectUser(Object sender, EventArgs e)
    {
        System.Web.UI.WebControls.Button buttonClicked = (System.Web.UI.WebControls.Button)sender;
        user = buttonClicked.Text;
        WebForm2.hasBegun = true;

        generateKey();
        sendEmail();

        Server.Transfer("WebForm2.aspx");

    }

    //creates and sends email//
     public void sendEmail()
        {

            System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage();
            message.To.Add(toEmail);
            message.Subject = "Password Reset [[WORK IN PROGRESS]]";
            message.From = new System.Net.Mail.MailAddress("email@example.com");
            message.Body = "Hello, <br /><br />This is an email regarding your request to have your password changed for Active Directory account: " + user + ". If you did not request this, please disregard and contact your administrator. <br /><h3>Your key is:</h3><br /><h1>" + key + "</h1><br />To continue and reset your password, go back to the webpage and enter the key above.";

            message.IsBodyHtml = true;
            System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("xxxxxx");

            smtp.Send(message);

        }

    //generates key used to verity email//
    public void generateKey()
    {
        var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
        var stringChars = new char[16];
        var random = new Random();

        for (int i = 0; i < stringChars.Length; i++)
        {
            stringChars[i] = chars[random.Next(chars.Length)];
        }
        key = new String(stringChars);
    }
//this is a cancel button that goes back to first page//
    protected void Button1_Click(object sender, EventArgs e)
    {
        WebForm2.hasBegun = false;

        Server.Transfer("WebForm1.aspx");
    }
}
}

```