c# - problem with HttpContext in mvc 2 -


i error when try access httpcontext.current controller. want session add session specific data, , gives me problem:

var = httpcontext.current.session;

the error, allegedly 'system.web.httpcontextbase' not contain definition 'current'.

when try access httpcontext.current controller

you should never use httpcontext.current.

simply use session property access session:

public actionresult index() {     session["foo"] = "bar";     ... } 

the reason error getting because controller class has property called httpcontext when write httpcontext.current property used , not static current property on httpcontext class.


Comments

Popular posts from this blog

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -

jQuery Ajax Render Fragments OR Whole Page -

java - Why is BlockingQueue.take() not releasing the thread? -