A frequent task for ASP developers is to create a members area style section of a website. This would normally involve registration, a login page, and then access to a section of the site that is only available to registered users. In this article James shows us how to do exactly that by using ASP and SQL Server. By the end of this article you'll have a fairly good idea of how you can implement your own members area on your site.
Creating a members area with ASP - The members area (Page 5 of 6 )
We aren't going to waste any time giving you ideas on what you can put in your members area; that's up to you. The only bit of code you need to include in all your members pages is a section to check if the user is logged in or not. If they aren't, then they are automatically redirect to the login page: <% If Session("loggedin") <> True Then Response.Redirect "login.asp" %> <html> <head> <title>Members Area</title> </head> <body> <h1>Members Area</h1> <p>Welcome to our members area!</p> </body> </html> and that's it! A few things to note...
If you try to access default.asp before you have logged in then you wonít be able to.
Once you have logged in, if you visit login.asp again, you will automatically be logged out. So, if you want a 'Log Out' link in the memberís area, simply link to login.asp
And that's it! You now have your very own members area!