How to auto-generate random password in asp.net mvc application?

No need to write again ... the question says it all.

+7
passwords random asp.net-mvc auto-generate
source share
4 answers

Here is a good article that can help you.

+7
source share

You can use the built-in function included in the System.Web.Security .

Memberhip.GeneratePassword Method
Generates a random password of the specified length.

+14
source share

In the past, I did this once using a piece of Guid. I just created a new guid, converted it to a string and took the part that I wanted, I think I used the characters in the back or vice versa. Tested it with 100 loops and every time the line was different.

It has nothing to do with MVC, though ...

+2
source share
  public string CreatePassword(int length) { const string valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; StringBuilder res = new StringBuilder(); Random rnd = new Random(); while (0 < length--) { res.Append(valid[rnd.Next(valid.Length)]); } return res.ToString(); } 
0
source share

All Articles