I haved created a registration form by create user wizard. Now what i wanted is dat after 2 day of registration user should have locked out automatically.


what shoule i do for this?

Recommended Answers

All 2 Replies

Two ways:
1: You can write some script in sql to run everyday, which will check all user's whose creationDate is older than 2 days and set the IsLockedOut to true.
I don't have code or much idea on how it can be done but something to think about.

2: Upon user Login button click or OnAuthenticate event of asp.net Login Control, you do something like this:

MembershipUser user = Membership.GetUser(Login1.UserName);
        if (user != null)
        {
            if (user.CreationDate > DateTime.Now.AddDays(-2))
            {
                user.IsApproved = false;
                Membership.UpdateUser(user);
            }
        }

Note: for second method, you still need to perform authentication

Thanks Guru sarkar
same type of idia was in my mind. you give me guidence and it worked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.