Forms Authentication – Creating Users


Last week we installed the tables into our database and set up the database connection so that we could implement forms based authentication.

This week, we need to put into place a way of creating users for our system.  The easiest way to do that is to create a form that allows our user to sign up.

You might think that you could just use the configuration tool that is in visual studio, but my experience is that if you use that tool and then move the database to another server, it doesn’t always work correctly.

But creating a sign-up screen isn’t that hard.

You’ll want to create a new form in your application.  You’ll probably call it sign up.

In your Visual Studio 2008 toolbox, you’ll notice a section of tools called “Login.” Expand that and drag and drop the “Create User Wizard” control onto the screen.

Since your application is already set to connect to the database where the information is stored, that’s all you HAVE to do.

But you can tweak the layout and some of the controls.

For example, you’ll notice in the properties window that you can change the content of many of the controls within the “Create user Wizard” control.  You can change the buttons from normal windows buttons to images or hyperlinks.  You can eliminate asking for a password by setting the AutoGeneratePassword property to true.

But you have even more control.  If you want to completely change the layout, you can create Templates for each of the steps and change the placement and add new controls.  Of course, if you add a new control, you’ll need to trap that information and store it yourself.  But it can be done by trapping an appropriate event and processing it there.  I can’t tell you exactly which one because your circumstances may be different, but a few that might work for you in your situation are the CreatingUser event, NextButtonClick event, or the FinishButtonClick event.

Related Post

Comments are closed.