ASP.NET Database Login

In a couple of previous tutorials we covered creating a simple ASP.NET login with the Session Object and also creating an ASP.NET Login with Forms Authentication.

In this tutorial we will create an ASP.NET Database login with a secure admin area, and a members only area. When the administrator logs in he will be authenticated and redirected to the 'admin/default.aspx' page, and when members log in they will be redirected to 'members/default.aspx'.

Anonymous users will not be able to browse the admin or member's folders. Members will obviously be able to browse the 'members' folder and every other page apart from those in the 'admin' folder, and admin can browse any folder within our site.

Figure 1 below shows how our website's directory structure will look.

Figure 1
ASP.NET Database Login file structure

The main files:

1. Login Page
2. Web.Config with Forms Authentication Enabled
3. Microsoft Access Database - the database will store the usernames and passwords of the members

The main functions:

1. To check administrator's login details against the Web.config
2. To check members login details against Microsoft Access database
3. To direct administrator and members to the correct admin page and homepage respectively
4. To set up security rules within the Web.config that allow or deny access to certain parts of the site

Part 2 - the Login Page
Part 3 - the Web.config file

Download the Source Code

Advertisements



MembersPro

MembersPro PayPal - ASP Membership software

Plug and play ASP membership script that integrates with PayPal to let you charge recurring membership fees.

Get your best asp web hosting provider now and save 25%