I’m the new here.
I’ve a problem like this: I create a Register page in ASP.NET (C#) which allow to guest can register an account at my site. All user must active their account before using my website, if after 15 minutes, user doesn’t active account by mail => delete that user from database, my problem is how to do it automatically?
I’m the new here. I’ve a problem like this: I create a Register page
Share
Rather than using a timer to remove a user, I would use a more conventional approach of having an expiration time for the user (or perhaps their password). That is, when they first register, assign an expiration for 15 minutes after the present time (e.g. in a column
ExpirationDatein the user table). In your authentication process, the logic should validate that the user’s ID has not expired.The problem with using a timer is that many things can go wrong. For example, if your application restarts, any active timers will be lost. It’s very brittle. It’s also kind of using a hammer to kill a fly. It’s not necessary to ensure that someone’s user record is removed immediately from the database after 15 minutes. It’s only necessary to make sure they can’t authenticate after that time. So make the design match the business purpose in the easiest possible way. If you really want to delete records (rather than, say, give them a chance to try again after resetting a password or something) then you can do this with some external maintenance process.