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

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -