June 12th, 2011, 11:42 PM
Join Date: Oct 2006
Location: , , .
Thanked 0 Times in 0 Posts
question RE modifying the CreateUserWizard
I'm trying to modify ASP.NET membership on a site so that users must enter a pre-supplied registration code in order to activate their membership. I'm not sure what the best way is to go about doing this.
- I'd like to be able to restrict new accounts from being activated until such a registration code is entered by the user.
- I don't want to have to log in as an admin and approve/activate user accounts manually.
- The “registration codes” would be supplied to users through an outside channel, and would be preloaded into the website's database.
- Ideally, the codes would correspond to pre-set roles in the membership system, and a user would automatically be assigned the specific role their code entitled them to.
For example, there would be an “EnrollmentCode” table in the database with data as follows:I have an idea of how this should function, but am not sure of the syntax I should be using; i.e.:
RoleGUID: 21ec2020-3aea-1069-a2dd-08002b30309d [ASP.NET GUID generated when a particular role was set up in the WSAT]
RoleName: customer1 [name corresponding to role set up in WSAT]
- User is sent to CreateAccount.aspx page with an instance of the standard CreateUserWizard control.
- The DisableCreatedUser property is set to "true”, so the user's account is disabled upon creation, and the user is sent by the ContinueDestinationPageUrl property to an EnterEnrollmentCode.aspx page, where they are prompted to...
- Enter their pre-supplied enrollment code. If the code matches a row appearing in the database's EnrollmentCode table, the user's account is activated and the user is assigned the role corresponding to that code.
- User creates an account in the CreateUserWizard, as above, but the wizard contains a custom step with a textbox for entering the enrollment code. Can a wizard step be used in this way to validate the code entered against the database, and to assign the role as specified by that database's row?
Thanks for any advice.