Click here to Skip to main content
14,328,926 members
Rate this:
Please Sign up or sign in to vote.
See more:
I want to logout my application if user not use apllication till 20 mins, so itried like below but its not working..session going time out but not redirecting to login page.

<authentication mode="Forms">
      <forms defaultUrl="~/login.aspx" loginUrl="~/login.aspx" slidingExpiration="true" timeout="10"></forms>
    </authentication>
Posted
Comments
ZurdoDev 4-Jun-15 8:54am
   
If you are wanting it to automatically redirect the user to your login page, it won't. What will happen is that the next time they request something from the server, for example they click a link, then they will be redirected to the login page.
RajeeshMenoth 4-Jun-15 8:58am
   
Try this..
<forms loginUrl="login.aspx" timeout="10"/>

Dawood507 4-Jun-15 9:00am
   
so how to do like I require?
Rate this:
Please Sign up or sign in to vote.

Solution 1

The Session is a Server concept, not a client: when it expires, the connection to the client has been broken, so your server code can no longer communicate with the client to change the page it is viewing.

You will have to do it in the javascript or HTML.
See here: http://stackoverflow.com/questions/709182/asp-net-implementing-auto-logout-functionality[^]
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

If you want to trigar time out from client side you have to create timer using any client scripts. Please click here to get sample code for timeout.

A small description which explains how form authentication works found here
   
Comments
Dawood507 9-Jun-15 6:19am
   
its not wokring..I alredy used it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100