Web Templates
Web Templates  
Photoshop Layouts  
Flash Templates  
Templates Resource - Web Templates
   
 
  Sign UpPassword
Templates Resource Services Support Specials Members View Cart
 
  Photoshop Tutorials
  HTML Tutorials
  ASP Tutorials
  CSS Tutorials
  Javascript Tutorials
  PHP Tutorials
  XML Tutorials
  Flash Tutorials
  Fireworks Tutorials
  3D Studio Max Tutorials
  Cinema 4d Tutorials
  Graphics
  Website Tools
  Web Templates
  About Templates Resource
  Affiliates Program
  TR Support
  Webmaster Resources
 Columbia Tech Support

WebDesignHelper.co.uk


 

Tutorials: ASP - Active Server Pages

Sessions

Intermediate

 

Sessions are a safer, more effective alternative to cookies. This tutorial will teach you how to use sessions in ASP.

Sessions are defined as a unique visit to a particular website and it's child pages. Each session can contain data, and the data in the session variables are user-specific. This data is stored during the entirety of the session, and is only accessible by the ASP pages which the user views or executes. How can ASP sessions be useful? Take an example: you have a large website with many users, and a user decides to log on using his username and password. How can you store this data for the entirety of his visit? You have two plausible choices: Cookies, and Sessions.

The advantage of using cookies is that once he logs in, the cookie stores the visitors information on that computer for as long as the duration of the cookie, even if the session is over. For example, if he logs in and browses around your site and then closes IE, and comes back tomorrow to your page, it'll still remember his name and password. The obvious disadvantage of cookies is that it's a security hazard. Also, some people have cookies disabled so it may not be a viable solution. ASP Sessions are a safer, guaranteed working method of storing variables in ASP throughout the duration of the visitors stay.

Because sessions automatically start upon the users arrival to the site, we don't need to declare that session variables will be used.

Here we store a username "Bobert" into a session variable:

<%
Session("username")="Bobert"
%>

Think of Session("username") as any other variable. you could

response.write Session("username")="Bobert"

just like you could any other variable.
If you want to destroy the contents of a session variable, you can use this piece of code:

<%
Session.Contents.Remove("username")
%>
And i

If you want to destroy the entire session prematurely, you can use this:

<%
Session.Abandon
%>


I hope you find this a safe yet effective way to store data such as a username or password.

 

This tutorial is provided to you by Spoono

More Tutorials
 

Active Server Pages Tutorials

AIM Screennames Viewer
This tutorial will show you how to make a script to see who has seen your AOL Instant Messenger profile.

Intermediate

Alternating Row Colors
Learn the basics of creating wonderfully abstract objects.

Intermediate

Browser Redirect
Learn how to do a Browser Redirect using the power of ASP.

Beginner

Cookies
Learn how to use cookies in ASP.

Intermediate

Counter
Learn how to make a hit counter in ASP.

Beginner

Database Connection
Learn the different ways to connect to different databases.

Intermediate

Database Insert
Learn how to insert a row into a MS Access database.

Beginner

Displaying Database
Learn a quick and easy way to display information from a database.

Beginner

Form Mail via CDONTS
Learn how to send mail using ASP and CDONTS

Intermediate

Form Mail via CDOSYS
Learn how to send mail using ASP and CDOSYS.

Intermediate

Number of Users Online
Use this code to display the number of users browsing.

Intermediate

Requests
Learn how to make use of requests.

Beginner

Sessions
Learn an alternative and effective solution to cookies in ASP using sessions.

Intermediate

String Functions
Learn the basic string functions available in ASP using VBScript

Beginner

XML Parsing
Use this nifty script to parse XML into HTML

Intermediate

Get help using .ASP here!

Get Free ASP Scripts here!

More Tutorials

Featured Web Templates

Web Template Preview 92311301

User Level:

Intermediate

Category:

Flash


Web Template Preview 92311401

User Level:

Intermediate

Category:

Flash



Web Template Preview 92311501

User Level:

Intermediate

Category:

Flash


Web Template Preview 92311701

User Level:

Intermediate

Category:

Flash


Web Template Preview 92311801

User Level:

Intermediate

Category:

Flash


Web Template Preview 92311901

User Level:

Intermediate

Category:

Flash


Web Template Preview 92312001

User Level:

Intermediate

Category:

Flash


Web Template Preview 92312101

User Level:

Intermediate

Category:

Flash


Web Template Preview 92312301

User Level:

Intermediate

Category:

Flash



Web Template Preview 92312401

User Level:

Intermediate

Category:

Flash

 

 

 

Templates Resource FAQ Services Terms of Use Site Map Support View Cart

© Copyright 2003-2008 Templates Resource