Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Bad routine to generate a password
Message
From
23/11/2006 17:27:39
Alexandre Palma
Harms Software, Inc.
Alverca, Portugal
 
 
To
23/11/2006 15:15:09
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01172129
Message ID:
01172160
Views:
19
Michel take a look into Membership.GeneratePassword Method I think that is what you want.

>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?
Alexandre Palma
Senior Application Architect
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform