Generate New Random Password

This function generates new random password of a given length. It supports maximum of 32 character of password. If length is given beyond 32 it will give ArgumentOutOfBound exception which is to be handled.

Private Function GetNewPassword(ByVal length As Integer) As String

Dim strNewPassword As String = ""

strNewPassword = System.Guid.NewGuid().ToString()

Return strNewPassword.Substring(0, length)

End Function


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: