Saturday, November 15, 2008

Generate Random password using C#.Net

Hi All,
I have seen a lot of code to create a random password using c#.Net. But i feel the following code is very simple to create. May be i am wrong but i got my solution with this.

public GenerateRandomPassword()
String strGuid=System.Guid.NewGuid().ToString();
strGuid=strGuid.Substring(0,8); //Here 8 means the password contains 8 characters.

hope you will enjoy...