usually you would send a random generated password while user does the registration process through your application.You can use the following code to achieve that.
public string Generate_Password()
{
string Password = “”;
byte Cnt, Idx;
string values = “0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ”;
Random rnd = new Random();
for (Cnt = 1; Cnt <= 6; Cnt++)
{
Idx = (byte)rnd.Next(0, values.Length);
Password += values.Substring(Idx, 1);
}
return Password.Trim().ToUpper();
}
To Generate Random Password we have used the Random Class(Namespace:-System).To learn more about Random Class have a look at this MSDN LINK.
0 comments:
Post a Comment