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?

1 Answer 1

69
HttpContext.Current.Session

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.