ASP 101 - Active Server Pages 101 - Web05
The Place ASP Developers Go!

Windows Technology Windows Technology
15 Seconds
ASP 101
ASP Wire
VB Forums
VB Wire
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an site
ASP 101 is an site
Internet News
Small Business
Personal Technology

Corporate Info
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash

 Top ASP 101 Stories Top ASP 101 Stories
Connections, Commands, And Procedures
What is ASP?
VBScript Classes: Part 1 of N

Query your database with ADO
Show All Tips >>
ASP 101 RSS Feed ASP 101 Updates

Quick Tips

Use the front door, please!
If you require visitors to log in to your site upon each visit, here's a simple way to make sure that they always do so before gaining access to the information on your site. Suppose you require the user to enter their first name into a form on your default.asp page and submit it prior to moving on to main.asp. That's a good start, assuming that your visitors all access your site via the default.asp page. However, unless you take the technique a step further, it would be easy enough to access the content of your site by pointing the browser to a specific page in your site, such as main.asp. You can prevent users from bypassing the default.asp with just a few lines of code.

First, when you process the form data containing the visitor's first name, write the name to a Session variable, as follows:

<% Session("FirstName") = Request.Form("fname") %>

Next, add the following lines of code prior to the <HTML> tag at the top of each page in your site
(except default.asp):
If Session("FirstName") = "" Then
End If

If the FirstName Session variable is blank, indicating that the visitor hasn't yet logged in, he'll be redirected to the default.asp page to do so.

Previous      Show All Tips      Next

If you have a tip you would like to submit, please send it to:

Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback
The Network for Technology Professionals



Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers