Generating Passwords in ASP.NET

Yesterday I was setting up the password recovery functionality for an ASP.NET web app I’m working on and discovered the convenience method System.Web.Security.Membership.GeneratePassword. It takes two parameters – the length of the password and the number of non-alphanumeric characters. It does the job and saved me some time writing my own method.