Click here to Skip to main content
13,193,064 members (63,556 online)
Click here to Skip to main content
Add your own
alternative version


13 bookmarked
Posted 6 Jan 2008

ASP.Net MembershipProvider : Auto generate password without nonalfanumaric character

, 6 Jan 2008
Rate this:
Please Sign up or sign in to vote.
Using ASP.Net MembershipProvider Auto Generate Password with does not contain nonalfanumaric character


In an application that uses Asp.Net MembershipProvider, in the membership process if you don't want to use character except letter in your generated password that send to your given e-mail address, you have to follow below steps.
Unfortunately it seems complicated and in my opinion there is a design mistake related MembershipProvider.

Using the code

It requires some changes with CreateUserWizard control :
For this create new web control derived by CreateUserWizard control and override Password property.

ToolboxData("<{0}:MyCreateUserWizard runat="server"></{0}:MyCreateUserWizard>")]
public class MyCreateUserWizard : CreateUserWizard

    public MyCreateUserWizard()
        : base()


    private string generatedPassword = string.Empty;

    public override string Password
            if (string.IsNullOrEmpty(generatedPassword))
                generatedPassword = GeneratePassword();

            return generatedPassword;


And if you want same feature with PasswordRecovery control, you have to create new class derived by System.Web.Security.SqlMembershipProvider and override GeneratePassword method.

public class MyMembershipProvider : System.Web.Security.SqlMembershipProvider

       public MyMembershipProvider()
           : base()

       public override string GeneratePassword()


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior) Dogan Tv Digital Platform Isletmeciligi A.s.
Turkey Turkey
No Biography provided

You may also be interested in...


Comments and Discussions

GeneralMy vote of 1 Pin
hims05611-Jan-13 20:32
memberhims05611-Jan-13 20:32 
GeneralRe: My vote of 1 Pin
gocebe17-Jan-13 8:59
membergocebe17-Jan-13 8:59 
QuestionGeneratePassword problem Pin
JeroenMX1-Apr-12 23:59
memberJeroenMX1-Apr-12 23:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171017.2 | Last Updated 6 Jan 2008
Article Copyright 2008 by gocebe
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid