Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate random password? [duplicate]

Tags:

c#

.net

asp.net

How to generate a random password of fixed length in ASP.net (no GUID) ? After generating the random password, I need to email the password to the specified user.

like image 543
user1554472 Avatar asked Apr 27 '26 07:04

user1554472


1 Answers

In the System.Web.Security namespace you'll find a way to generate passwords:

string pw = Membership.GeneratePassword(8, 1);

You can provide the length of the password in the first parameter. The second is to indicate the minimum number of non-alphanumeric characters in the generated password.

MSDN

like image 98
Koen Avatar answered Apr 29 '26 21:04

Koen