IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
ASP Classic
Search ASP Classic Group:

Advanced
-Collapse +Expand ASP Classic Store

Prestwood eMagazine

October Edition
Subscribe now! It's Free!
Enter your email:

   ► KBWebsite Scri...ASP ClassicLanguage Basics   Print This     
  From the November 2015 Issue of Prestwood eMag
 
ASP Classic Language Basics:
Clear Application and Session Variables Using ASP classic
 
Posted 17 years ago on 2/16/2007 and updated 5/1/2010
Take Away:

Use Application.Contents.RemoveAll and Session.Contents.RemoveAll

KB100452

You can use Application.Contents.RemoveAll and Session.Contents.RemoveAll. The following code removes all session and application variables using ASP classic:

Application.Contents.RemoveAll
Session.Contents.RemoveAll

You can also remove a single application or session variable with Application.Contents.Remove and Session.Contents.Remove. For example, the following code removes ONE application variable and ONE session variable:

Application.Contents.Remove("VisitorCount")
Session.Contents.Remove("UserID")

Other Things That Clear Session and Application Variables

In addition to your code explicitly clearing application and session variables, there are a number of other instances where they are cleared. For example:

  • Web Server Recycled - For example with a server restart or when IIS detects a web server recycle is needed (see App Pools).
  • When you copy a new Global.asa file to your web server.

Unreliable Session and Application Variables

Sometimes session and application variables are unreliable. For example, in a load balancing scenario, they are spread over multiple web servers, app pools, or web gardens (see Web Gardens).

Application Variables and Web Gardens

If you are running your own IIS server, you'll want to set your Web Gardens value to 1 so that you don't virtualize your web server session and application variables.

In Internet Information Services (IIS) Manager, select your server, Application Pools, right click on your app pool, select Properties. On the Performance tab, adjust the Maximum number of worker processes.

More Info


Comments

0 Comments.
Share a thought or comment...
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P157A1
Enter key:
KB Post Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #100452 Counter
38167
Since 4/2/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]