I didn't want you logged in! How to prevent new users being signed in with CreateUserWizard

This one has come up twice in the past week as an unknown feature of the CreateUserWizard. I've seen developers performing complicated code-behind magic to try and prevent the user being logged in and others simply asking if its possible.
The default behaviour of the CreateUserWizard is that when it has created the user it logs that new user in.
You might not want this for a few reasons:
  1. You are in an admin panel and you don't open up your signup's to the public.
  2. You have some extra coding in place that sends out a verification email before they are let into the system
  3. You want to review the accounts by hand before you activate them
  4. Some other mysterious reason

Well the way to prevent it is to add the following attribute to your CreateUserWizard control:


Its a simple as that - when the newly created user is created they are not logged in.

Further Reading

kick it on DotNetKicks.com