|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Global.asa
I started working with the global.asa file recently And I have som problem.
I was able to set a application variable in the global.asa and also retrive it from an ASP file that is in the root directory. The problem is that if that ASP file is in a subdirectory then the application variable is empty. Is application variables are only transfred in one dir? |
|
#2
|
|||
|
|||
|
Assuming you have 5 different web sites *all* under the wwwroot folder. Something like:
wwwroot --[web site 1] --[web site 2] --[web site 3] --[web site 4] --[web site 5] Application variables are used per web sites. This means you can have an application variable for web site 1 but you wont be able to read its content from within web site 4 for example. Now I've a lot of people putting the Connection String into the Application variable. NOTE: I said Connection String NOT the Connection OBJECT. This way the Connection String is held inside the Application variable for the entire web site! But why not put it inside the Session variable one might ask ? Because, assuming you have 100 users connecting to your web site and that, for some odd reason, you decide to put the connection string into the session variable. You'll end up having/holding 100 Session variable holding the SAME connection String. As opposed to having only ONE Connection String inside the Application variable. Hope this helps! Sincerely Vlince |
|
#3
|
|||
|
|||
|
Thanks, I only wanted to confirm what I thought, but I still have some simple qustions, If you can:
-Is there a way to share application vars in some websites? -Does a application var has a life limit? |
|
#4
|
|||
|
|||
|
Maybe this would helps clarify things...
Each application can have only one global.asa and the application variable(s) exist per application. In order words, image a hosting company that host 3 different web sites/applications. These web sites/applications are: -yahoo.com -ebay.com -vlinces-palace.com Do you think for one second that I could read the value of the application variable that is on the yahoo.com web site? Even if we all share the same hosting company? (NOTE: Assuming that we are NOT on dedicated servers) Answer is NO, I can't see the other application variables thus I can't share/obtain the data that's inside. As for the life limit of the application variable it loses its data each time the server reboots. Hope this helps! Sincerely Vlince |
|
#5
|
||||
|
||||
|
Quote:
I just wanted to expand this a little since it sounds like we ae talking to a more junior developer. But application variables will loose their data when the asp application hits Application_OnEnd(). YOu can hit application end from several ways. One of those is rebooting the server another would be restarting iis or even relaunching the global.asa with changes. Sorry for being so anal...
__________________
mr... mike.rusaw@realpage.com RalPage, Inc. "I have made this letter longer than usual, only because I have not had the time to make it shorter." - Blaise Paschal |
|
#6
|
|||
|
|||
|
To be noted: I have had session variables CONTINUE to live even after stopping and restarting IIS (in W2K) with the Internet Services Manager - the only way to really flush everything out is stop/start the "Service" (World Wide Web Publishing Service) in Services (Computer Management)
|
|
#7
|
|||
|
|||
|
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Global.asa |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|