iamserious
iamserious

Reputation: 5475

Manually activate user account in asp.net

I have a (difficult to work with) client who has created an account in our website, however, he cannot log in because he hasnt clicked the account activation link yet. for some reason, he doesnt want to click it (he thinks its virus)

anyway, I want to manually set the account to activated via database.. how do I do that? thanks!

( i mean, which fields needs to be changed to what values?)

Upvotes: 3

Views: 2406

Answers (4)

Yale
Yale

Reputation: 21

I had the same problem recently and I found that when you are doing the Membership.CreateUser call you can make it that the user is automatically created as true by inserting it like this:

Membership.CreateUser(userName, Password, eMail, passwordQuestion, passwordAnswer, isApproved)

The isApproved is a bool and can be set as true when you call the create user.

Upvotes: 2

iamserious
iamserious

Reputation: 5475

I did some fiddeling around the aspnet membership table and found out how to activate the account manually!

update aspnetdb.dbo.aspnet_Membership set IsApproved = 1 where UserId = (select UserId From aspnetdb.dbo.aspnet_Users where UserName = @Username)

the userid is ridiculously long so i found it easier to pick it up from username from users table.

Upvotes: 4

this. __curious_geek
this. __curious_geek

Reputation: 43207

call these two methods on your MembershipProvider.

        Membership.GetUser().UnlockUser();
        Membership.GetUser().IsApproved = true;

Upvotes: 4

Gertjan
Gertjan

Reputation: 880

Can't you temporary assign your own address to the account and resend the activation url? Maybe he can forward you the mail and you can click the link. Think that is easier than "hacking" your way into the membership provider.

Also calling your client dumb is not a very good way to handle your clients ;)

Upvotes: 1

Related Questions