auto generate password

asp.net Tirupati, India
  • 13 years ago

    hi...
    I am doing a project asp.net with C#.my requirement I want to do auto generate password for my application that means when user forget his password when he clicks a link it will auto generate a new password and then it will send to a secondary mail

  • 13 years ago

    Hi there,

        Random rnd = new Random();
    byte[] GenPassword = new byte[9];
    for (int i = 0; i <= 7; i++) {
    GenPassword(i) = rnd.Next(65, 90);
    }
    txtUserName.Text = System.Text.Encoding.UTF8.GetString(GenPassword);

  • 13 years ago

    hi.... 

         thanx for giving reply

    it is showing error!!

         'GenPassword' is a 'variable' but is used like a 'method'

  • 13 years ago

    Hi there,

    Sorry for delay and for error. I didn't check my code.

                Random rnd = new Random();
    byte[] GenPassword = new byte[9];
    for (int i = 0; i <= 7; i++)
    {
    GenPassword[i] = (byte)rnd.Next(65, 90);
    }
    textBox1.Text = System.Text.Encoding.UTF8.GetString(GenPassword);
  • 13 years ago

     this  is really helpful  me tooo

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“In theory, theory and practice are the same. In practice, they're not.”