How to generate random passwords

G

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
 
P

Peter Rilling

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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top