how to access session object from non page class

  • Thread starter Thread starter Wee Bubba
  • Start date Start date
W

Wee Bubba

i have a seperate class which i want to access the session state from.
as a workaround i am able to access the session state by inheriting
from the Page class. but this seems a waste as I dont need any other
Page features. i.e.

public class Stopwatch : Page //inherit from Page class to get access
to session object
{
...
}

is there a more efficient way to gain access to the session object
from my class?

thanks.
 
Wee Bubba said:
i have a seperate class which i want to access the session state from.
as a workaround i am able to access the session state by inheriting
from the Page class. but this seems a waste as I dont need any other
Page features. i.e.

something like...


using System.Web;

HttpContext.Current.Session["blah"]
 
i have a seperate class which i want to access the session state from.
as a workaround i am able to access the session state by inheriting
from the Page class. but this seems a waste as I dont need any other
Page features. i.e.

public class Stopwatch : Page //inherit from Page class to get access
to session object
{
...
}

is there a more efficient way to gain access to the session object
from my class?

thanks.



----------------------------------------------------------

----------------------------------------------------------
color]

Try System.Web.HttpContext.Current.Session

(note the .Current part may not be needed, haven't confirmed that yet)
 
Back
Top