简体   繁体   English

Asp.net会话时间太短

[英]Asp.net session time is too short

I am creating webforms with asp.net. 我正在使用asp.net创建webforms。 Website is working based session authority. 网站基于会话权限工作。 But i have problem from session timeouts. 但我从会话超时有问题。 for example when i logged in to my system after 4-5 minutes session will expire. 例如,当我在4-5分钟后登录我的系统会话将过期。 I tried everything to make session timeout longer. 我尝试了一切使会话超时更长。 Here is something ; 这是一些东西;

I changed plesk panel session timeout to 2000; 我将plesk面板会话超时改为2000;

in web.config file 在web.config文件中

<sessionState timeout="120"></sessionState>

my login page 我的登录页面

Session["user_id"] = "12313";
Session["username"] = "john doe";
Session.Timeout = 2000;

i am using these codes for control session. 我正在使用这些代码进行控制会话。 in my default.aspx page 在我的default.aspx页面中

if(Session["user_id"] != null)
{
Response.Write("you are logged");
}
else
{
Response.Write("Please sign in");
}

Why my session expires in 4-5 minutes? 为什么我的会话在4-5分钟内到期?

you can use following code block in your web.config file. 您可以在web.config文件中使用以下代码块。

<system.web>
    <sessionState mode="InProc" cookieless="false" timeout="60" />
</system.web>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM