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
Post a Comment