![]() |
|
|
Session Variables in ASPSession variables are stored in the server's computers memory. They are deleted once the visitor closes his browser or after a period of inactivity, usually 20 minutes by default. Below is the syntax for creating a session variable and assigning a value to it. syntax:Session(“SessionName”)=value Why use session variables? Session variables come in very handy for tracking purposes. Some e-commerce
sites use session variables to store items in memory that have been placed
into a shopping basket. <% Now If we wanted to create secure pages that only admin could access we could place the code in Example 1 at the top of newly created pages. This would check to see if the visitor has logged in properly with the admin username and password because if they have the Session("BlnAdminLoggedIn") will hold a value of true in their computers memory. If not then redirect the visitor to another page called 'noaccess.asp'. Example 1: <%
Site developed by Michael Wall - Web Design Belfast N.Ireland. |
|