Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Alert user before end of ASP session

Status
Not open for further replies.

schick

Programmer
Jun 12, 2001
33
0
0
US
I need to alert my users prior to their asp session expiring. I would like to allow them to click a button to extend there session. Is this possible? What are my other options. Any help is appreciated.

Thanks,

Josh
 
I can't help with the code, but with the idea.
After the page load use javascript for a client side counter. There is a time or timer object as I remember. Set it using current session time. For example

var session_time = <%=current_session_time%>;

When counter is zero (or any value you like in this case) a messagebox should appear and ask for extra time. Cancel should retun(false), OK should send some parameter to the current page. Something like

document.location = 'page.asp?sessiontime=<%=current_session_time+extra_session_time%>';

At the beginning of the page put something like

if request.querstring(&quot;sessiontime&quot;)<>&quot;&quot; then
session.timeout = cint(request.querstring(&quot;sessiontime&quot;))
else
session.timeout = 30 ' default
end if

' Also set some other default values
extra_session_time = 10
current_session_time = session.timeout

Let me know if it works.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top