faqts : Computers : Programming : Languages : Asp : ASP/VBScript : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

20 of 23 people (87%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

How can I clear and reset my Application variables?

May 19th, 2000 06:28
unknown unknown, Dave Cline, Scott Dexter


I created a AppClear.ASP file and in it I actually "include" my 
Global.ASA file!

=============================================================
<!--#INCLUDE file="../global.asa"-->
<%

        Application.Lock

        Set Col = Application.Contents
        For Each key in Col
                Col(key) = Empty
        Next

'--- global asa routines
        LoadProductSampleCount
        LoadManufacturerArrays
        LoadProductAttributes

        Application.Unlock

%>
Application Reloaded

=============================================================


1. I clear all my Application level variables (static arrays, constants,
etc.) with the loop.

2. Then I have routines in my Global.ASA which I normally call in
Application_OnStart() - that I reference in this AppClear.ASP which 
reload the Application with new arrays, contants, etc.

App Reset!

The Application Lock and Unlock methods are there to prevent race 
conditions.



© 1999-2004 Synop Pty Ltd