Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bad routine to generate a password
Message
De
23/11/2006 17:07:10
 
 
À
23/11/2006 15:15:09
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01172129
Message ID:
01172155
Vues:
48
This message has been marked as the solution to the initial question of the thread.
>I have this code to generate a password with letters and digits:
>
>
>        ' Generate a password
>        ' expN1 Length of the password
>        Public Function GeneratePwd(ByVal tnLength As Integer) As String
>            Dim lcPassword As String = ""
>            Dim lnCounter As Integer = 0
>            Dim lnRandom As Integer = 0
>
>            For lnCounter = 1 To tnLength
>                If lnCounter = 1 Or Int(Rnd() * 100) Mod 2 = 0 Then
>                    lnRandom = Int(Rnd() * 25) + 97
>                Else
>                    lnRandom = Int(Rnd() * 9) + 48
>                End If
>                lcPassword = lcPassword + Chr(lnRandom)
>            Next
>
>            Return lcPassword
>        End Function
>
>
>This code has been converted from VFP. However, this does not work very well in .NET. It practically always generates the same password. Anyone would have something better to recommend?

GIYF: http://www.google.ca/search?q=vb.net+password+generator
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform