send random password to user

50 pts.
Tags:
ASP.NET
hi , I would like to ask if anyone know how to use the password recovery . I would like to send a email with a random password to the user. How can i achieve that?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Password recovery and sending a user a random password are two different things.

Password recovery would be getting the current password from the database (or where ever it’s stored) and sending it to the user. In some cases, this may be impossible. For instance, if you’re storing a hash of the password, rather than the password itself, you won’t be able to retrieve that password (that’s why you’d do that, actually — for security purposes.)

A new password can be generated in a few ways. The easiest way is to use a random number generator, select several digits (6-10) with values between 0 and 62 then convert these numbers to [0-9a-zA-Z] to generate the password. This should give you a nice random password that you can then email to the user.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • YuvalShavit
    The one issue with generating numbers 0-255 and then converting these to ASCII is that some characters will be either inconvenient or impossible to type. ASCII 0-31 don't correspond to typed characters, and 32 corresponds to space, which will likely lead to confusion. Values above 126 correspond to extended ASCII (accented chars and such) that you probably won't want to make your users type out, and even within the 32-126 range there are three stretches of punctuation (which you may or may not want). The easiest thing to do is to just pull from a list of characters you do want. In C, you can do this very easily using the fact that C-strings are arrays: int randomCharIndex; char* passwordChars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; char randomChar; randomCharIndex = rand() % strlen(passwordChars); // gets a number from 0-n, n being the index of the last char in passwordChars randomChar = passwordChars[randomCharIndex]; Of course, you can optimize this by getting rid of strlen and such. This should help get you started, though.
    905 pointsBadges:
    report
  • Khairy
    Hi all, Regarding the second question,we can use any password generator program!!!!!! Regards, Khairy
    25 pointsBadges:
    report
  • Blue
    is there any sample program on this?
    50 pointsBadges:
    report
  • Blue
    string[] userArray = { "admin" }; string[] emailArray = { "bluefloss01@hotmail.com" }; protected void Page_Load(object sender, EventArgs e) { } protected void Login1_Authenticate(string user, string email) { bool authenicated = false; bool userExist = false; int count = 0; foreach (string id in userArray) { count++; if (id.Equals(user)) { userExist = true; break; } } if (userExist) { if (emailArray[count].Equals(email)) { authenicated = true; } } } protected void PasswordRecovery1_SendingMail(object sender, MailMessageEventArgs e) { e.Message.IsBodyHtml = false; e.Message.Subject = "New password on Web site."; string randomString = Guid.NewGuid().ToString(); } here is my program but is there anyway that i need to do in order to config the mail? the program is unable to run due to Login1_Authenticate part . can anyone help me to continue?
    50 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following