How to generate random passwords

Discussion in 'ASP .Net' started by Guest, Nov 22, 2004.

  1. Guest

    Guest Guest

    Hi,

    I want to generate a random password every time a new user account is
    created. I want to include small and capital letters and 0 to 9 digits. Can
    someone give me some idea as how should I do it? I am a beginner in ASP.NET
    and using VB.net to code the pages so please do not give me any clues in C#
    because I don’t know that language.

    Thanks
    Joe
     
    Guest, Nov 22, 2004
    #1
    1. Advertisements

  2. I have not done this so I have no code to offer, but here are the general
    steps that you could implement.

    1) Create an array of characters that contains all the valid characters in
    the password.
    2) Use the Math.Random class to randomly generate a number that is less
    then the size of the just-created array. This will be you index into the
    array.
    3) Determine how many letters you want and loop that number of times. Each
    time through, append the new character to a password variable based on the
    random index created.
     
    Peter Rilling, Nov 23, 2004
    #2
    1. Advertisements

  3. Alphonse Giambrone, Nov 23, 2004
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.