Click here to Skip to main content
15,900,364 members
Please Sign up or sign in to vote.
1.00/5 (1 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.

XML
<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.
[no name] 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?

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[^]
 
Share this answer
 
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
 
Share this answer
 
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, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900