R
RSH
If I have a static method that references the HttpContext.Current object is
it safe to be in a static method within a class under ASP .Net?
I know that static classes are shared by all sessions at a given time, so Im
not sure if this can be a static class.
public static SessionManager Instance
{
get
{
HttpContext context = HttpContext.Current;
SessionManager manager = context.Session[SESSION_MANAGER] as SessionManager;
if (manager == null)
{
manager = new SessionManager();
context.Session[SESSION_MANAGER] = manager;
}
return manager;
}
}
Thanks!
Ron
it safe to be in a static method within a class under ASP .Net?
I know that static classes are shared by all sessions at a given time, so Im
not sure if this can be a static class.
public static SessionManager Instance
{
get
{
HttpContext context = HttpContext.Current;
SessionManager manager = context.Session[SESSION_MANAGER] as SessionManager;
if (manager == null)
{
manager = new SessionManager();
context.Session[SESSION_MANAGER] = manager;
}
return manager;
}
}
Thanks!
Ron