Global Variables

  • Thread starter Thread starter J
  • Start date Start date
J

J

What is the correct method to use if I want to store a variable within my
web application, that is available to every single page within the
application, but is lost when the user navigates to a page outside of the
app.

I don't want to use session variables because they only last a short period
of time (and I'm NOT allowed to increase the session variable time on the
web-server).

TIA
 
You're SOL. How is the variable supposed to be lost when the user Session
ends? For example, let's say that you use a Cookie instead, and don't set an
expiration. What you've done is the equivalent of a client-side Session
variable. When the Session ends, the Cookie will be destroyed. When does the
Session end? When there are no requests for a new page from the same domain
within a certain time period. If you don't use an object that times out when
no requests for a page from the same domain are made, how are you going to
determine the end of the Session? The browser doesn't inform the server that
it's navigating away or closing. HTTP is stateless.

What you need to do is USE Session, but use it wisely. Make sure your app
includes code to handle what happens if the Session is lost due to
inactivity and a new Session is started.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Neither a follower nor a lender be.
 
Agree, but as to how that is done i am clueless.
But what you describe certainly sounds like Session variable is the most
logical of all
Application variable is not so appropriate since it sounded like you wanted
the variable
to be user particular

Cheers

J
 
why are you not allowed to tamper with session on the webserver?
what's the point of cruisecontrol on a car if you aren't allowed to use it?
seems like you need to go talk to whoever made that rule and ask them to
answer this question cuz i can see no good reason for that limitation.
 
Back
Top