Database Storage with the ASP.NET Web Matrix: Simple Login Page
(Page 1 of 5 )
This article covers the creation of a basic login page for your website. With this page, when a registered member returns to your website and logs in, he or she will be able to access restricted or personal areas of your site.
If you read my last article about creating, connecting and writing to a database using the Microsoft Web Matrix, you should have a working registration page that will allow users to enter a username and password into your database, thus registering as a member. Certain criteria were also enforced, such as unique usernames and a minimum password length of seven characters.
This article will focus on creating a login page to go with the registration page so that when a member returns, they are able to access restricted or personal areas of your site. The page itself will be very basic, just a simple demonstration of reading data from a database and matching records.
To begin with, you’ll need to create a standard ASP.NET page from the general templates section. You also need to make sure that the database from the previous example (members) is connected, and if not, connect it by choosing the Add Database Connection button from the Data pane at the far right of the Web Matrix, then by selecting the database in the Connect to SQL or MSDE Database dialog box.
Once that is done, set up the registration page by, in the Design view, dragging a label web control, a textbox web control and another label web control onto one line, then another line featuring the same controls. Then on a new line, drag a button web control onto the page, and finally, on another new line, drag a final label control onto the page.
Next: Start with the Properties pane >>
More Database Articles
More By Dan Wellman