Application Variables

Results 1 to 2 of 2

Thread: Application Variables

  1. #1
    David Wyatt Guest

    Default Application Variables

    HELP! <BR><BR>Hi, i am having great difficulty on my site. It uses a login feature. On the login check it creates many sessions from an access database to use throughout my site. I have added a new feature to my site of "whos online now!", i have done this by creating an application variable in the login script. so:<BR><BR>application(session.sessionID) = objrs("username")<BR><BR>Then listing all the applications will show the current users.<BR><BR>I have modded my global.asa to say:<BR><BR>Sub Session_OnEnd<BR><BR>application(session.sessionID ) = ""<BR><BR>I have created some javascript that every minute it runs an asp script to keep the session open etc - which runs on "every" page!<BR><BR>so you get that, i only list varaibles with values in them.<BR><BR>Problems have arisen big style in the way that some application variables are not getting deleted. By this i mean that old applications still have values in them and thus showing people online that are not really online. <BR><BR>Another problem is that if i log into my site, load up another browser and log into it again, my name is featured twice.<BR><BR>Please please please can you help. if there is a better way to do it i will be most gratefull. i heard of using arrays, but i dont really understand them. <BR><BR>Also is there a way of deleting "ALL" of my application variables inlcuding the sesionID&#039;s.<BR><BR>thankyou all so much for your responses in advance.<BR><BR><BR>david wyatt<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Session_onEnd unreliable...

    Don&#039;t ask me why, but apparently under some circumstances Session_onEnd is not "fired", and so those sessions never get deleted.<BR><BR>I really think that using Application(Session.SessionID) is a mistake. You&#039;d be much better off using an Application array or using Application(UserName). In either case, record the *time* of that last use of a given user and then you can clean out the unused values by looking for those that are more than (say) a few minutes old.<BR><BR>Ehhh...maybe Application(Session.SessionID) is okay...but still record *at least* both the username and the Date/Time (e.g., by storing them as a two element array in the app value) so you have a means of finding the old ones.<BR><BR>Ehhh...but then again, if you used Application(UserName), then a later login could automatically wipe out an earlier one, couldn&#039;t it?<BR><BR>As for removing them: *IF* you are using IIS 5.0, then you can do Application.Contents.Remove (see the IIS 5.0 docs).<BR><BR>If you are not using IIS 5, then the best thing to do is use a single array to hold all users, as I believe I suggested once upon a time, so that you *can* then delete individual values easily.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts