Ender Aric
Ender Aric

Reputation: 257

Asp.net session time is too short

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?

Upvotes: 4

Views: 2243

Answers (2)

Dhaval Pankhaniya
Dhaval Pankhaniya

Reputation: 1996

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

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

Upvotes: 3

Kami
Kami

Reputation: 365

The following links might help resolving the issue. Managing Session TimeOut using Web.Config

Weird Timeouts with custom ASP.NET FormsAuthentication

Upvotes: 0

Related Questions