Solved

Classic ASP application variables sporting empty strings

Posted on 2006-11-17
5
766 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

770 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