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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -