how to access session object from non page class

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.
 
J

Josh

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"]
 
C

Craig Deelsnyder

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)
 

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

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top