Avatar of Ed
Ed
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Keeping Users Logged in asp.net(vb)

Whats the best way to keep users session active if they are using the application.

Eg

My app redirects users back to the login page if the user session is dropped. Tis us usually no browser activity after 20 mins.  The problem is that some users spend time typing a lot of text into textboxes and when they go to submit they get logged out because they have lost their session.
ASP.NET.NET ProgrammingVisual Basic.NET

Avatar of undefined
Last Comment
Ed

8/22/2022 - Mon
Russ Suter

The easiest thing to do would be to modify the web.config file and specify an unusually long timeout for the authentication.

    <authentication mode="Forms">
      <forms loginUrl="~/Account/Signin.aspx" timeout="50000000" slidingExpiration="true" defaultUrl="~/Default.aspx" />
    </authentication>

Open in new window


The timeout attribute specifies the number of minutes an authentication session remains active. Be aware, however that this does greatly reduce website security.
Daniel Van Der Werken

The items you need to worry about are the session timeout in the web.config and the application pool timeout as established at the IIS site level.

1. Modify or set the session timeout in the web.config. What Russ Suter says above may work in place of the web.config session timeout setting. Not sure myself.

2. Run the IIS configuration manager on the IIS server and open the application pool settings. There is a timeout value for the application pool. Make sure it matches what you have in the web.config.

I've successfully set a production site to 30 minutes in this fashion in my environment.
ASKER CERTIFIED SOLUTION
damey

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ed

ASKER
good solution
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck