Learn Scripting Languages from the Master!
With this script, you can generate a random password of a random length between 6 and 10. This script may come very handy if you need to generate random passwords let say when you want to temporarily assign a forgotten password to a user.
<%dim strPasswordstrPassword = GenerateRandomPassword ()response.write "Random Password: " & strPasswordfunction GenerateRandomPassword ()dim intPWLength, intLoop, intCharType, strPwdConst intMinPWLength = 6Const intMaxPWLength = 10RandomizeintPWLength = int((intMaxPWLength - intMinPWLength + 1) * Rnd + intMinPWLength)for intLoop = 1 To intPWLengthRandomizeintCharType = Int((3 * Rnd) + 1)select case intCharTypecase 1RandomizestrPwd = strPwd & CHR(Int((25 * Rnd) + 97))case 2RandomizestrPwd = strPwd & CHR(Int((25 * Rnd) + 65))case 3RandomizestrPwd = strPwd & CHR(Int((9 * Rnd) + 48))end selectnextGenerateRandomPassword = strPwdend function%>