Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Global variables - application variables vs include file

Reply
Thread Tools

Global variables - application variables vs include file

 
 
mark4asp
Guest
Posts: n/a
 
      09-03-2003
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?

 
Reply With Quote
 
 
 
 
CJM
Guest
Posts: n/a
 
      09-03-2003
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" <mark4asp#killspam#@ntlworld.com> wrote in message
news:(E-Mail Removed)...
> 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?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/* #include <someyhing.h> */ => include it or do not include it?That is the question .... Andreas Bogenberger C Programming 3 02-22-2008 10:53 AM
Global variables in include file razael1@gmail.com C++ 1 12-07-2006 02:44 AM
FWSM/PIX and Dynamic PAT using global IP range vs. global interface vs. global IP Hoffa Cisco 1 10-25-2006 06:50 PM
FWSM/PIX and Dynamic PAT using global IP range vs. global interface vs. global IP Hoffa Cisco 0 10-25-2006 01:04 PM
#include "file" -vs- #include <file> Victor Bazarov C++ 4 03-06-2005 07:09 PM



Advertisments