skip to Main Content

I am creating webforms with asp.net. 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. I tried everything to make session timeout longer. Here is something ;

I changed plesk panel session timeout to 2000;

in web.config file

<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

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

Why my session expires in 4-5 minutes?

2

Answers


  1. you can use following code block in your web.config file.

    <system.web>
        <sessionState mode="InProc" cookieless="false" timeout="60" />
    </system.web>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search