Wrox Programmer Forums
|
ASP Pro Code Clinic As of Oct 5, 2005, this forum is now locked. No posts have been deleted. Please use "Classic ASP Professional" at: http://p2p.wrox.com/forum.asp?FORUM_ID=56 for discussions similar to the old ASP Pro Code Clinic or one of the other many remaining ASP and ASP.NET forums here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Pro Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 20th, 2004, 06:04 PM
Registered User
 
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Application Variable Usage

I want to always know the last order number assigned (plus some other variables)and assumed that by assigning it to an application variable I would accomplish this. I find, however, that these variables are cleared from time to time so I assume an application times out after awhile and is started anew. I suppose this means that I must write code within global.asa (Application_OnEnd) to save the variables to a disk file and code in Application_OnStart to read them in and reset them as Application variables. Before I begin doing this I thought I'd check my assumptions with someone who has already encountered and solved this need.

 
Old February 20th, 2004, 07:21 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Yes, your assumptions are correct. Depending on your OS, IIS is restarted every now and then (for example, Windows Server 2003 has a setting that allows you to restart the application every xx minutes or hours, preventing possible memory leaks for example).

It's indeed a good idea to store this information in a text file, or in a database. If I were you, I wouldn't rely on on Application_OnEnd, but instead write the data to the file as soon as it is changed.

Check out the following article that describes this entire process. It uses a Hit Counter as an example, but basically you can save anything you want:

http://Imar.Spaanjaars.Som/QuickDocID.aspx?QUICKDOC=164

There is also a database version of the article, where the contents are stored in a database:

http://Imar.Spaanjaars.Som/QuickDocID.aspx?QUICKDOC=165

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable Usage in Insert Command tara0308 Access VBA 7 July 30th, 2007 12:50 PM
Using Application state variable value in Web form smp4774 ASP.NET 2.0 Basics 1 April 10th, 2007 07:55 AM
Variable with application scope madhukp PHP How-To 0 January 8th, 2005 12:41 AM
how to call Application Variable from global .asax ranakdinesh ASP.NET 1.0 and 1.1 Basics 2 August 6th, 2004 06:01 AM
how to call application variable in global.asa mqnguyen Classic ASP Basics 4 July 28th, 2003 11:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.