Solved

Redirect when timed out

Posted on 2014-04-07
7
224 Views
Last Modified: 2014-04-11
I am using the script below for authorization and like to know if there is a way to extend, so when people were idle for about 20 minutes, they get redirected to a "timeout.asp" page.

<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="admin"
MM_authFailedURL="failure.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
  If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If
%>

Open in new window

0
Comment
Question by:hanskoens
  • 3
  • 2
  • 2
7 Comments
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39983708
You have probably seen scripts for session timeout

<% 
    Session.Timeout = 30 
    Server.ScriptTimeout = 180
%>

Open in new window


But for the idle time out you need to adjust in your app pool in iis.

http://technet.microsoft.com/en-us/library/cc771956(v=ws.10).aspx
0
 
LVL 2

Author Comment

by:hanskoens
ID: 39983722
I have done that but for some reason without results. After changing I iisreset IIS and also rebooted server. I want the timeout session being part of the login session, if possible.
0
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 200 total points
ID: 39983758
The login session and idle time out are not the same.   You can set your session.timeout to 180 minutes if you want.  But, if the user is sitting and staring at their screen for more than 5 minutes, they will experience  a timeout.  

Another reason they could be prematurely timing out is if the app pool gets reset.   If you want somebody to be logged in for a long period of time, a cookie might be a good choice.  Otherwise, I found the idle timeout to be the weak link no matter what you have your session timeout set for in your code.
0
ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

 
LVL 33

Accepted Solution

by:
Big Monty earned 300 total points
ID: 39989854
if you are talking about if a user is on the same page for xxx amount of minutes and you want to redirect the user to another page after xxx amount of minutes has passed, then you'll need to set a timer in javascript, and when the time expires, do the appropriate action.

I use the following code to pop up a window that tells the user their login session has expired and gives them the choice to re-login. If they do, all of their session data is re-populated and they can go back to the page they were on without any issues.

window.setTimeout("timedout = true; window.open('/logout/timedout.htm','timedout','menubar=no,scrollbars=no,resizable=no,location=no,height=365,width=380')",300);

you'll notice the last parameter, in this case "300", is the time in seconds you want to set the timer for. So 60 x 5 minutes is 300 seconds.
0
 
LVL 2

Author Comment

by:hanskoens
ID: 39993542
Is there a way to close the popup window after 60 seconds automatcally?
0
 
LVL 33

Expert Comment

by:Big Monty
ID: 39994185
please open a new question with a reference to link to this question
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39994200
Yea, it is just in the javascript for the pop up.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Exit a vb6 apps when a calling it apps closes 15 48
ASP SQL Syntax Duplicate Key 7 102
Recommendation vb6 to vb.net or others 14 149
Syntax for query to update table 2 13
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question