Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 web.config 中有这个:
<sessionState timeout="70"/>
和:
<authentication mode="Forms"> <forms loginUrl="~/Index" timeout="60" /> </authentication>
我也有这个:
Session.Timeout = 70;
所以,一个小时左右后,用户仍然登录,但会话为空,我的程序崩溃了。任何想法?
You have to put a check if your session is null then redirect to login page.
Actually the code in the question is correct. However, everytime I rebuild my code, the session was lost. That was the problem.