How auto log out after 30 min inactivity?

C

Cirene

Using ASP.NET membership. How do I automatically log a user out of the
system after 30 min of inactivity? Thanks.
 
J

Juan T. Llibre

Since you're using forms authentication, modify the forms authentication timeout :

<forms name=".ASPXAUTH" loginUrl="login.aspx" protection="All" timeout="30" path="/"
requireSSL="false" slidingExpiration="true">
 
C

Cirene

Thanks. I assume this is in the web.config file, correc?

Do I put that statement under here?
<authentication mode="Forms"/>
 
C

Cowboy \(Gregory A. Beamer\)

What Juan has suggested handles the backend. You may also want to consider
adding something that kicks the user to the login page after the session is
gone (or actually just before, as the timeout is not guaranteed 100%).

To do that you can use a meta-refresh tag on every page for 30 minutes. Kick
the user to a logout page that does the following:

1. Kicks off membership
2. Abandons session

#1 should be accomplished by #2, but you can code both for safety. Then have
that page forward a person to the login page.

Setting the config will lose the session, etc., but if a person is in the
middle of a form, he will not find out until he hits the submit button.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top