Help creating global session - a bit stuck

T

Tarun Mistry

Hi all,

I'm trying to create a global object that can be used anywhere in my ASP.NET
(2.0) application but im having problems.

I would like to run some logic every time the page is loaded, this logic
then initalises a global variable (an object) of type "ShoppingCart".
ShoppingCart needs access to the system Session and the Response objects.

Originally, I put my code into the global.asax file under the
"session_start" member, exposing the ShoppingCart object as a static
variable. I have realised here my code only runs once, when the session is
started, and not EVERY time the page is loaded.

I am not sure where to create my ShoppingCart object such that it will be
available to the rest of the system. I Tried Application_Start however at
this point the Session and Response objects have not yet been initialised.

Any advice welcome! Thanks for your help.
Taz
 

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

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top