Add Session varaible in an ordinary class

  • Thread starter Thread starter RonL
  • Start date Start date
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
 
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
 
Back
Top