Hi all,
You guys might have applied for any online exams where after the submission a registeration ID(which is a 6-7 digit) and a alpha numeric password.. How to generate alpha numeric password ????? Plzz help me
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jaganathan BantheswaranPosted Feb 17, 2011, 2:56 PM
Functionality:
generatedPassword = CreateRandomPassword(10);
while(IsPasswordExists(generatedPassword))
generatedPassword = CreateRandomPassword(10);
Where IsPasswordExists(generatedPassword) is a method which checks for the availability of password in the database. If password is exists then it should return true.
Suthish NairPosted Feb 17, 2011, 1:45 PM
Kavita BPosted Feb 16, 2011, 7:13 AM
My problem here is:
I want to give the user a registertaion ID and a password(which is a ALPHA NUMERIC PASSWORD) and these 2 should be UNIQUE after the user has submitted an online application...
How do i do this please help...
@ Suthish
Yes these are generated from SQL CODE BEHIND for that user and should be UNIQUE......PLEASE HELP ME FRIENDS
Suthish NairPosted Feb 16, 2011, 3:21 AM
Do you want to create it from code behind or sql backend.
From SQL: select SUBSTRING(CONVERT(varchar(255), NEWID()), 0, 7)
Sam HobbsPosted Feb 16, 2011, 12:16 AM
Kavita BPosted Feb 15, 2011, 9:51 PM
Here ALPHA NUMERIC password is generated AUTOMATICALLY by the system for the people who have registered so that they can use it in future to download the application etc...
Jaganathan BantheswaranPosted Feb 15, 2011, 10:35 AM
public static string CreateRandomPassword(int PasswordLength)
{
string _allowedChars = "0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ";
Random randNum = new Random();
char[] chars = new char[PasswordLength];
int allowedCharCount = _allowedChars.Length;
for (int i = 0; i < PasswordLength; i++)
{
chars[i] = _allowedChars[(int)((_allowedChars.Length) * randNum.NextDouble())];
}
return new string(chars);
}
If you feel this is correct what you need, please make this as Accepted Answer.
Thanks.