开发者

Auto Logout in asp.net

开发者 https://www.devze.com 2023-01-26 17:48 出处:网络
I have a oneApplication in .net , I want Auto Logout If data entry Operation rest For Five minute then !

I have a one Application in .net ,

I want Auto Logout If data entry Operation rest For Five minute then !

application is auto logout !

will it only logout if nothing is done at screen !

I have tried Below Code But Session Is Expire even if work is on !

<authentication mode="Forms">
     &开发者_JS百科lt;forms loginUrl="../frmLogin.aspx" timeout ="1000" />
 </authentication>
    <sessionState mode="InProc" timeout="1" cookieless="false">
 </sessionState>

Thanks

Regard Samarth patel


You have to add this in your web.config file for Auto Logout

<system.web>
    <sessionState  timeout="1" />  
</system.web>


You need to set your session timeout to 300seconds. And yes, it will only expire if nothing happens. Even just a request to the server resets it i think. this means that if you have a timed ajax-request in the background that is less than the session timeout, your session will never time out. (I think... :| )


Well, session is defined on the server, in general everytime a user interacts with the server, the session time is lengthened.

So first set your session to 300 seconds. And perhaps, client side , have a timeout for 3100 ms, that will in the end navigate to the login page. If the user navigates away within the end of the timeout, it's ok, the session is being lengthened.
If he reaches the timeout (and you don't do any ajax stuff!!!), then the server session has ended.

0

精彩评论

暂无评论...
验证码 换一张
取 消