Change Users Standard status: IsApproved

Topics: Developer Forum, User Forum
Developer
Apr 6, 2007 at 2:53 PM
When a user registers itself the account is activated directly. In our environment we need an account admin to decide if the account is valid and can be activated.

I created a workaround to change this behavior: a trigger on the database table: aspnet_Membership

Thought I would share the source with you all:
----------------------------------------------


CREATE TRIGGER ChangeIsApproved ON dbo.aspnet_Membership
FOR INSERT
AS
BEGIN

DECLARE @UserId uniqueidentifier

SELECT @UserId = (SELECT UserId FROM Inserted)

UPDATE dbo.aspnet_Membership SET IsApproved = 0 WHERE UserId = @UserId

END


Developer
Apr 19, 2007 at 2:16 PM
After more investigation a more sophisticated solution is to add the following to the register.aspx page:

DisableCreatedUser="True"

Change:

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" OnCreatedUser="CreateUserWizard1_CreatedUser">

to:

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" OnCreatedUser="CreateUserWizard1_CreatedUser" DisableCreatedUser="True">