asp.net mvc - Why is the session null in a method inside controller -
i creating mvc 5 application. grabs array of objects json deserialize create new object , store object in session. can access session in partial view , working fine when click in link on page direct me method in same controller , try retrieve session null. has idea why happening. store in method in controller , return view , driver object
httpcontext.session["allinfo"] = driver; httpcontext.session["loggedin"] = true;
then check in partial view , create dynamic links. working fine till here loggedin true , allinfo not null
@if (httpcontext.current.session["loggedin"] != null) { <li>@html.actionlink("other links", "index", "home")</li> <li>@html.actionlink("other links", "about", "home")</li> <li>@html.actionlink("other links", "contact", "home")</li> }
a link in page navigate user different view. in controller try retrieve session null now. why happening???
driver = (driver) httpcontext.session["allinfo"];
Comments
Post a Comment