?
Solved

Classic ASP application variables sporting empty strings

Posted on 2006-11-17
5
Medium Priority
?
782 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
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…
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.
Suggested Courses

777 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