Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Generate a password as a Random Number

Status
Not open for further replies.

sbind77

Programmer
Oct 2, 2001
29
US
Hi

I have to generate a Random number which acts as a password for the User Name I create.

The Random Number should be a 12 digit Integer and for which the User doesn't have any right to change his password

which is the best feasible solution for the above.


Thank You
sbind77
 
The following will give you a 12-digit random number.


Call GiveRandom(999999999999,000000000001)

<%
' This function generates Random numbers
Function GiveRandom(high, low)
Randomize()
GiveRandom = Int((high - low + 1) * Rnd + low)
End Function
%>

To not allow them to change their password, don't have an input field for password when they initially register as a user. Generate their password, then send it to them via email, or if security isn't a major issue, display it in the browser for them after they register. When we send passwords via email, we don't include the username in the same message or the URL that the password is used for. Makes it a little more difficult for a snoop to make use of the password.
If security is a major issue, then you could consider an encryption solution (such as PGP, or ASPEncrypt)



 
I'm sorry, instead of

Call GiveRandom(999999999999,000000000001)

it would be

password = GiveRandom(999999999999,000000000001)

sorry 'bout that!

:~/
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top