Session Variables

  • Thread starter Thread starter Guest
  • Start date Start date
Hi,

Session variables allow you to pass data to another page in the
website or save data between post backs.

Ken
 
when querying the first page of a asp.net application a session object is
created on the webserver , in this session object wich is availlable as long
as you are active on the website + 20 minutes you can store session
specific values .

You use this object normally for storing vallues that are logicly related
to a specific user


this could be a shopcart , a username , or anything else you can think of
( it is even possible to store complete objects in the session object )


regards

Michel Posseth [MCP]
 
Michel,
You use this object normally for storing vallues that are logicly related
to a specific user
In my opinion is "normally" "only". For shared use you need to use a shared
class or the cache.

Cor
 
Well you could also use a database for the same purpose , and abbandon
session vars completely , this aproach is often used in webfarm scenario`s
where you can`t use session variabels at all or when coockies are not
allowed on the target machine .

And for a fact ,,,,, i was once consulted by a firm who stored there
database connection object in a session var ( and asked me why there server
run out of resources so quick )


:-)

but okay you are right in your statement that
In my opinion is "normally" "only". For shared use you need to use a shared
class or the cache.

regards

Michel
 
I think I understand session variables a little so let me try to explain them:

Suppose you have an application that allows users to login to your website.
When a user logs in, the applications starts a new session for that user.
You can look up the user data like his name, address, etc. in a database and
store this in an instance of a class you have defined for user data. This
class instance can then be stored in a session variable as say "currentuser".
As the user moves from one of your application web pages to another, you can
determine his name, id, etc. from the session variable in any page of your
application.

There are also Application variables that are available to all your pages in
all the sessions.

Session variables are really easy and handy if you have an application with
different pages.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top