you mentioned "page" are you talking about an asp.net application?
if so, the containers break down like this
application: available across all sessions for the life of the application
cache: available across all sessions for the life of the application. values are periodically flushed, so you need to account for that.
session: specific to each user for the life of the application
items: specific to the current request
querystring: self explanatory
form: self explanatory
cookies: self explanatory
params: aggregation of form, querystring, items and cookies
there should be very few, if any objects you store in the cache or application directly.
if you're using an IoC container the typical setup is
Code:
public class Global : HttpApplication
{
public static IWindsorContainer Container;
public void Application_Start(object sender, EventArgs e)
{
Container = new WindsorContainer();
//configure container
}
public void Application_End(object sender, EventArgs e)
{
Container.Dispose();
}
}
I have found the HttpContext.Items container is a great place to store database connections. You can open a single connection for the length of the request and commit/close at the end. I have an FAQ on this approach. see my signature for the link.
if you want to store user specific values that are relatively static the session is the best choice.
Jason Meckley
Programmer
Specialty Bakers, Inc.
faq855-7190