In my MVC application, when I run my application when I didn't do any changes in my application the scripts work and goes to the to login page after one min (to test the script I have default set -1
to the sessiontimeout
so it will be easy to check script working or not) , now my issue is when I contionusly go on working in my appication also it's redirecting to login page do how to modify this script:
<script type="text/javascript">
function keepAlive() {
window.clearTimeout(window.sessionKeepAlive);
window.sessionKeepAlive = window.setTimeout( function() {
window.location.href = '<%= Url.Action( "LogOn", "Account" ) %>';
}, 开发者_Go百科<%= (Session.Timeout - 19) * 60 * 1000 %>);
} keepAlive();
</script>
Well, the typical (default) session timeout is 20 minutes, and you're subtracting 19...I think you want to just subtract 1
here so you get 60 seconds notice, so this:
<%= (Session.Timeout - 19) * 60 * 1000 %>
Should be:
<%= (Session.Timeout - 1) * 60 * 1000 %>
精彩评论