Get Random Password (String) Using GUID, Password Length (Maximum) 32 Char


Get Random Password (String) Using GUID, Password Length (Maximum) 32 Char

Get Random Password (String) Using GUID
GUID - Represents a Globally unique identifier.
Purpose : Function For Generatind Password Using System.Guid.NewGuid()
Paramete : Length - Passward Length (Maximum) 32 Char

Code:


Public Function GetRandomPasswordUsingGUID1(ByVal length As Double) As String
Dim guidResult As String = System.Guid.NewGuid.ToString
guidResult = guidResult.Replace("-", String.Empty) 'Use to Remove "-" from Random Passward
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

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: