Solved

Classic ASP application variables sporting empty strings

Posted on 2006-11-17
5
765 Views
Last Modified: 2010-08-05
My classic ASP applications rely on an application variable, application("Mode"), to know whether to exhibit test-environment or production-environment behavior.

At application_onstart, application("Mode") gets set to "dev" or "prod," depending on which site the user is accessing (I'm the only one accessing the "dev" site; all other users will access the prod version).

I'm the only developer of the applications and am developing on our development server, so if I understand application variables correctly, when I've been out past session timeout (10 minutes) and then access the dev site again, we can assume everything's re-initialized in dev.

Yesterday evening, one of our servers--not dev--got an upgrade from .NET 1.1 to 2.0.

First run this morning, both my classic ASPs on dev misbehaved, displaying no value for application("Mode").  

In case there was any connection I didn't know about between the dev server and the upgraded server, I talked with the upgrader, and he reemphasized the upgrade should not have affected them.  However, both applications had run fine yesterday.

Any input appreciated.  How did my dev apps fail to initialize their application-variable values?



My global, for one program:
------------------------------------------------------------------------------------------------------
<SCRIPT Runat="Server" Language="VBScript">
      sub application_on_start()
            session.timeout = 10            'sessions timeout after specified minutes.
            application("Log")                   = "true"
            application("Mode")                  = "dev"
      end sub
      sub session_onStart()
            session("lvl")                        = ""
            session("ApplicationID")            = ""
      end sub
</SCRIPT>




usage within program:
------------------------------------------------------------------------------------------------------

                  Select Case application("Mode")
                        Case "dev"
                                                          ...
                        Case "prod"
                                                          ...
                        Case else
                                                                               'here's the code executed because application("Mode") is empty
                              Response.Redirect("AccessDenied.aspx")  
                  End Select
0
Comment
Question by:CAWhite
  • 2
5 Comments
 
LVL 6

Expert Comment

by:davbouchard
ID: 17967136
There is actually a different. In ASP 2.0, the global file is moved to a script file. I am unsure as to why both your applications did this if he hasn't touched the dev server...

This site here explains how to fix it the global file : http://rossnelson.blogspot.com/2005/11/fixing-globalasax-in-aspnet-20.html :
"To add a global.asax, (or web.config for that matter), simply right click the web site or web server project in your solution explorer, select Add New Item from the context menu and then choose Global Application Class (or Web Configuration File for a web.config)."

I hope that helps.
0
 

Author Comment

by:CAWhite
ID: 17967274
Thanks for the info.  Alas, this application I've inherited is destined to remain a classic ASP for now ( despite the reference to an aspx I didn't even find in the folder) , and supposedly this server has not had a change.  I'm going to keep trying to figure out what happened to the app-variables.
0
 

Author Comment

by:CAWhite
ID: 17979178
OK, now the word is that the dev server did get updated--sounds like the upgrader hadn't anticipated that.  Since my two old applications were the only ones affected (global.asas not in wide use here, I guess), I moved my code to the applications' start pages.  Made my boss happy.
0
 
LVL 1

Accepted Solution

by:
DarthMod earned 0 total points
ID: 18025185
PAQd, 250 points refunded.

DarthMod
CS Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Suggestion on WebSite Template Sites 6 83
cookies analysis tools 2 72
What language/protocol is the Angular Chat? 2 57
compact pure CSS Read More Toggle 4 24
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now