.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Melody Anderson
Eminent IT

Home >> Code Snippets >> Visual Studio >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

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

Posted By:Prasanti Prusty       Posted Date: December 16, 2009    Points: 10    Category: Visual Studio    URL: http://www.dotnetspark.com  

' 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) 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


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend