I don't know about 'ASP' but in vb you could use this function:
....
Dim strPassword As String
Dim intCount As Integer
Try
For intCount = 0 To 5
strPassword &= GetRandomPasswordChar()
Next
....
Private Function GetRandomPasswordChar() As Char
Dim objRandom As Random
Dim objTimer As DateTime
Dim intChar As Integer
Dim intTicks As Integer
Dim dblStart As Double
Try
REM Create timer.
objTimer = New DateTime()
REM Get 'random' value for Random class constructor.
intTicks = Convert.ToInt32(DateTime.Now.Millisecond)
REM Wait for a few milliseconds to create different values.
dblStart = objTimer.Now.TimeOfDay.TotalMilliseconds()
While objTimer.Now.TimeOfDay.TotalMilliseconds() - dblStart < 13
Application.DoEvents()
End While
REM Create Random object.
objRandom = New Random(intTicks)
REM Get random value between 48 ('0') and 122 ('z').
intChar = objRandom.Next(48, 122)
REM Make sure character value is valid.
While (intChar > 57 And intChar < 65) Or (intChar > 90 And
intChar < 97)
intChar = objRandom.Next(48, 122)
End While
REM Return char.
Return Convert.ToChar(intChar)
Catch X As Exception
Return Convert.ToChar("-"c) ' Failed.
End Try
End Function
"krishna" <ve*************@gamil.com> schreef in bericht
news:1f****************************@phx.gbl...
Hi,
I would like genarate of 6 alpha nuemaric characters
password automatically in ASP.NET.plz
how to make it.
Waiting for the reply.
krishna