45

I would like to access the session object without passing it to my static helper function.

This is so I can save and load things from the session object automatically with minimum extra fluff.

Is it possible/how can I access the session object from within a static method in a static class?

Joshua Enfield
  • 17,642
  • 10
  • 51
  • 98

1 Answers1

69
HttpContext.Current.Session

MSDN: http://msdn.microsoft.com/en-us/library/system.web.httpcontext.current(v=vs.110).aspx

Tim Schmelter
  • 450,073
  • 74
  • 686
  • 939