Posts tagged ‘beginner’

March 11, 2011

ASP.NET Membership Provider Part 1

ASP.NET has a membership provider built-in that can be used to authenticate and manage the users who will be visiting your website. These features can be used to determine if a user viewing the website is authenticated or anonymous and to display content according to who is viewing the page. There are also controls for creating new users, changing passwords, and logging in.

Creating The Database

In order to use the ASP.NET membership provider you will need to create a database. The membership tables can either be part of the application’s database or it can be its own database.

Integrating the membership tables with your application’s database has a few benefits such as being able to create foreign keys between the membership tables and your own. However, creating the membership tables in their own database will allow multiple website to use the same database for authentication.

To crate the tables and store procedures navigate to Start –> All Programs –> Microsoft Visual Studio XXXX –> Visual Studio Tools –> Visual Studio Command Prompt.

Enter the command aspnet_reqsql to start the ASP.NET SQL Server Setup Wizard

Figure 1

Figure 1: Visual Studio Command Prompt

After the wizard has started click next.

Figure 2

Figure 2: ASP.NET SQL Server Setup Wizard

Select “Configure SQL Server for application services.”

Figure 3

Figure 3: ASP.NET SQL Server Setup Wizard

Enter the server’s name and credentials if necessary. Also select the database where the ASP.NET membership tables and stored procedures should be created.

Figure 4

Figure 4: ASP.NET SQL Server Setup Wizard

Verify the entered information is correct and click next. Then click finish.

Figure 5

Figure 5: ASP.NET SQL Server Setup Wizard

The tables and stored procedures for ASP.NET Membership have now been added to the selected database.

Configuring The Application

The next step is to configure the application’s web.config file.

First setup your connection string to the database. If you created the ASP.NET Membership tables in a separate database you will need to create two connection strings.

Figure 6

Figure 6: Connection String Settings

Now we need to change the authentication mode to forms and set the login URL for the web site.

Figure 7

Figure 7: Authentication Settings

Next we need to setup the membership settings.

Note: The application name setting is used when multiple websites use the same database for authentication.

Figure 8

Figure 8: Membership Settings

Moving Forward

Your database and website are now configured to use the built in ASP.NET membership provider. In part 2 I will discuss the controls(login, register, validation) built into ASP.NET to take advantage of the membership provider.

January 27, 2011

New Programmer Skill: Why Debugging Is So Important

by Auri Rahimzadeh, President, The Auri Group

When things go wrong with code, you need to be able to find the bug quickly. The process for hunting down and killing bugs is called “debugging.” These days it’s incredibly easy to debug, making your job as a programmer much easier. I will spare you the history lesson on how debugging was done when I was growing up 🙂

read more »