Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET - Access Session from static method/static class?

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?

like image 659
Joshua Enfield Avatar asked Apr 07 '11 19:04

Joshua Enfield


1 Answers

HttpContext.Current.Session

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

like image 189
Tim Schmelter Avatar answered Nov 02 '22 09:11

Tim Schmelter