Solved

Classic ASP application variables sporting empty strings

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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
The viewer will learn how to dynamically set the form action using jQuery.
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.

726 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