|
-
Mar 30th, 2001, 02:48 PM
#1
Thread Starter
Hyperactive Member
How should I go about declaring global variables for my ASP pages? I want to have some variables that will be constant throughout the pages. Is there some way that I can store all of them in the same page and then include them with the other pages, like a VB module?
-
Mar 30th, 2001, 02:59 PM
#2
Hyperactive Member
You should be able to use the global.asa file. 
Wait, let me clarify that a bit:
You can create a session variable in the global.asa file so that every asp page will have access to it.
Last edited by compuGEEK; Mar 30th, 2001 at 03:06 PM.
-
Mar 30th, 2001, 03:28 PM
#3
Black Cat
You could store them all in a file and use Server-Side Includes on each page to get it.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Mar 30th, 2001, 03:32 PM
#4
Thread Starter
Hyperactive Member
Thanks guys for the suggestions
compuGeek - how do I go about creating a session variable? I am new to ASP. I put
<!-- include file "global.asa" -->
in all of the files, and that seems to work, albeit a bit inefficiently.
-
Mar 30th, 2001, 03:46 PM
#5
Lively Member
My suggestion is try to avoid session variables, it is has lots of disadvantages, for more info check msdn.microsoft.com..
Sonia
-
Mar 30th, 2001, 04:37 PM
#6
You create a session variable like this:
Session("strUserName") = "bubba"
You can change the value of a session variable at anytime.
Some (potential) problems with session variables are;
They are stored in memory, so if you have a lot of users connected at once and your session variables contain a lot of data, there could be performance issues;
If the user disables cookies on their browser, session variables don't work;
If you are using a web farm, and your re-directs contain the complete url (response.redirect "http://newasp.asp") rather than the logical path (response.redirect "../newdir/newpage.asp ") the session variables could be lost.
Of course, these problems do not always occur, and there are other potential problems (which I'm sure somebody will point out) that may present themselves.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|