Add Session varaible in an ordinary class

R

RonL

I'm unable to add a session variable in a non-page class. Any ideas?

I've tried

System.Web.SessionState.HttpSessionState session =
HttpContext.Current.Session;

session["ABC"] = messageBody;



also

System.Web.SessionState.HttpSessionState session =
HttpContext.Current.Session;

session.Add("ABC", messageBody");



also



HttpContext current = HttpContext.Current;

current.Session["ABC"] = messageBody;



Ron
 
R

RonL

I jsut noticed that it does not work if there no session variables exist. If
I add a different Session variable in a start up page then it works fine.

Ron
 

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
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top