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 %>

Get Active Server Pages 3.0 from Scratch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.