473,326 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Global variables - application variables vs include file

What are the best methods for using global constants and variables?

I've noticed that many people put all global constants in a file and
include that file on every page. This is the best way of doing it - is
it not? Once the application has loaded the page it is cached and is
immediately available for other pages.

With global variables - the best thing to do would be to use
application variables - so long as there weren't too many declared.
Is there another (easy) way of using global variables apart from using
application variables?

Jul 19 '05 #1
1 4315
CJM
Yes, Application variables are a good use for global variables. And yes, too
many application variable can eventually have an impact on the server, so
you must be reasonable.

Things like connection strings, paths and other CONSTANTS are ideal fodder
for application variables. So are VARIABLES that need to be available to all
users (ie. across all sessions), eg. a Hit-Count.

However, I'd query what you mean by 'global variables'. You could be meaning
a variable that is 'global' for one user/one session. In this case, Session
variables might be in order.

To take this argument further, you might choose to avoid session variables
(because they can have a hit on the server), in which case you can use DBs
and Querystrings to maintain state.

I hope this all makes some sense...! lol

Chris
"mark4asp" <ma****************@ntlworld.com> wrote in message
news:5u********************************@4ax.com...
What are the best methods for using global constants and variables?

I've noticed that many people put all global constants in a file and
include that file on every page. This is the best way of doing it - is
it not? Once the application has loaded the page it is cached and is
immediately available for other pages.

With global variables - the best thing to do would be to use
application variables - so long as there weren't too many declared.
Is there another (easy) way of using global variables apart from using
application variables?

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Patient Guy | last post by:
I have a library of functions representing a filesystem interface (essentially a file selection interface, to be used in opening/reading/writing/closing files). Heavily scripted HTML document...
7
by: Michael | last post by:
Hi newsgroup, as the subject indicates I am looking for an advice using global variables. I am not if this problem is more about style then C. If its wrong in thi group, sorry. So I have a...
6
by: Andrea Williams | last post by:
Where is the best place to put global variables. In traditional ASP I used to put all of them into an include file and include it in every page. Will the Global.aspx.cs do that same thing? ...
22
by: fd123456 | last post by:
Hi Tom ! Sorry about the messy quoting, Google is playing tricks on me at the moment. > Global.asax is where you normally have the Global Application > and Session variables and code to...
8
by: Giorgio | last post by:
Hi all, i have a problem with a website where i use asp 3 and a global.asa in the root. In global.asa i use some aaplication variables which contains strings, such as: Application("str1")="text"....
7
by: zeecanvas | last post by:
Hi, First of all: Yes, I know global variables are bad, but I've a huge amount of legacy code, and I've to maintain it _as_is_. I'm maintaining a big program. I moved all (program-wide scope)...
3
by: Stephen Kay | last post by:
Sorry fi this is a stupid question - I come from a c/c++ background, and the global variables in php aren't making sense to me. If I want to declare a global variable, say in a global.php file,...
1
by: Mukesh_Singh_Nick | last post by:
I am learning classic ASP 3.0. Below are my questions: 1. Do we have to include (<!-- #include FILE="global.asa" -->) the global.asa file into every .asp page? I am doing the examples in Windows...
15
by: =?Utf-8?B?UGF0Qg==?= | last post by:
Just starting to move to ASP.NET 2.0 and having trouble with the Global.asax code file. In 1.1 I could have a code behind file for the global.asax file. This allow for shared variables of the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.