O'Reilly logo

Active Server Pages 3.0 from Scratch by Nicholas Chase

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Cookie Expiration Dates

Now that we've set our cookie, let's do something with it. After users have logged in, we don't need for them to log in again, so we'll tell the login page to check for our cookie in Listing 5.12, and display a different message if it finds it.

Code Listing 5.12. login.asp: Checking to see if the user is already logged in
0: <%@ LANGUAGE="VBSCRIPT" %>
1: <% pageTitle = "Outpost Login" %>
2: <!--#include virtual="/pagetop.txt"-->
3:
4: <%
5: 'First check to see if user is already logged in
6: if Request.cookies("isLoggedInAs") = "" then  %>
7:
8:      <H2>Member Login</H2>
9:
10:     <% if Request.querystring("retry") = "password" then %>

11:          <h3>Invalid Password</h3>
12:     <% elseif Request.querystring("") = "username" then %>

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required