Get Random Passward (String) Using GUID , Passward Length (Maximum) 36 Char

Posted by Chikul under VB.NET category on | Views : 2452
' Get Random Passward (String) Using GUID
' GUID - Represents a Globally unique identifier.
' Purpose : Function For Generatind Password Using System.Guid.NewGuid()
' Paramete : Length - Passward Length (Maximum) 36 Char

    Public Function GetRandomPasswordUsingGUID(ByVal length As Double) As String
Dim guidResult As String = System.Guid.NewGuid.ToString
If length <= 0 OrElse length > guidResult.Length Then
Throw New ArgumentException("Length must be between 1 and " & guidResult.Length)
End If
Return guidResult.Substring(0, length)
End Function

Comments or Responses

Login to post response