473,587 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

YET ANOTHER QUESTION ON SESSION TIMEOUT AND SESSION_ONEND()

hi there,
i've 2 questions for you guys....
1: is there any way to "force" a session_onend() , session timeout or
at least call my logout method when a user leaves the application
window without logging out? i.e: using the "X" in the right corner???
i'd like to reset to their default all my variables session?? is this
possible???

2: I've succesfully been able to ask the user to confirm whether he
wants to extend his session before it ends due to inactivity. This
works perfectly and my question is: if the user is not there to answer
the question is there any way to automaticaly end the session after 1
minutes without any answer???

i.e:
function UserToConfirm()
{
if (confirm('Hey.. .your session is about to time out extend?'))//if
the user
//is not there to answer, then force log out ho to do this?????
{
clearTimeout(Se ssionTimer );
}
else
{
parent.top.loca tion.href = 'LogOut.asp';

}
}

function SetSessionTimer ()
{
if(SessionTimer > 0)
{
clearTimeout(Se ssionTimer );
}
TimeOutID = setTimeout("Use rToConfirm()",1 20000);//2
minutes
//before session ends
}
and i call my SetSessionTimer () method in my body onload event...
thanks a lot...
Jul 20 '05 #1
4 4825
ho*****@yahoo.c om (HolaGoogle) writes:
hi there,
i've 2 questions for you guys....
1: is there any way to "force" a session_onend() , session timeout or
at least call my logout method when a user leaves the application
window without logging out? i.e: using the "X" in the right corner???
No. They might not even be connected to the internet when they close
the browser.
2: I've succesfully been able to ask the user to confirm whether he
wants to extend his session before it ends due to inactivity. This
works perfectly and my question is: if the user is not there to answer
the question is there any way to automaticaly end the session after 1
minutes without any answer???


Probably. Don't use a modal confirm dialog, though. You have no way
of making that go away after one minute. If you use HTML to pose
the question, you can remove it again, and then do whatever you want.

I.e., something like:
---
/**
* text : text to display for yes/no answer
* onYes : optional, function called if yes chosen
* onNo : optional, function called if no chosen
* timeout : optional, time in milliseconds before defaulting
* timeoutDefault: optional, default answer for timeout
*
* Don't omit both onYes and onNo.
*/
function myConfirm(text, onYes,onNo,time out,timeoutDefa ult) {
var div = document.create Element("div");
div.style.borde r = "3px grey outset";
div.style.width ="8em";
div.style.heigh t="6em";
div.style.backg round = "grey";
div.style.posit ion = "absolute"; // or use fixed
div.style.left = "10em";
div.style.top = "10em"; // do something to make sure it is visible
var p = document.create Element("p");
p.appendChild(d ocument.createT extNode(text));
div.appendChild (p);
var div2 = document.create Element("div");
div2.style.text Align = "center";
var butYes = document.create Element("input" );
butYes.style.ma rgin="0px 5px";
butYes.type="bu tton";
butYes.value="Y es";
butYes.onclick= function(){acti on(true);};
var butNo = document.create Element("input" );
butNo.style.mar gin="0px 5px";
butNo.type="but ton";
butNo.value="No ";
butNo.onclick= function(){acti on(false);};
div2.appendChil d(butYes);
div2.appendChil d(butNo);
div.appendChild (div2);
div.style.zInde x = 1;
document.body.a ppendChild(div) ;
if (timeout) {
var timer = setTimeout(func tion(){action(t imeoutDefault); },timeout);
}
function action(choice) {
clearTimeout(ti mer);
document.body.r emoveChild(div) ;
if (choice) { if (onYes) {onYes();}}
else { if (onNo) {onNo();} }
}
}
---
You can call it as, e.g.,:
---
myConfirm("Are you sure?",
function(){aler t("yes");},func tion(){alert("n o");},
5000,true);
---
You should do something more to make sure the dialogue is visible, even
if the page is scrolled down.

You can save code space by having the confirm HTML already in the page,
and just changing the actions and text.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Thanks Lasse for your quick answer...i<ll try your solution and let
you know...yeah you<Re right i tried everything to make my confirm
dialog go away after 1 minute and couldn't. So i'm gonna try you way
and see what happens.

For my 1st question, i do have a logout method, is there any way that
i could use this instead of calling session_end() to force the user to
logout when he exits the application???

Thanks a lot once again....

Lasse Reichstein Nielsen <lr*@hotpop.com > wrote in message news:<pt******* ***@hotpop.com> ...
ho*****@yahoo.c om (HolaGoogle) writes:
hi there,
i've 2 questions for you guys....
1: is there any way to "force" a session_onend() , session timeout or
at least call my logout method when a user leaves the application
window without logging out? i.e: using the "X" in the right corner???


No. They might not even be connected to the internet when they close
the browser.
2: I've succesfully been able to ask the user to confirm whether he
wants to extend his session before it ends due to inactivity. This
works perfectly and my question is: if the user is not there to answer
the question is there any way to automaticaly end the session after 1
minutes without any answer???


Probably. Don't use a modal confirm dialog, though. You have no way
of making that go away after one minute. If you use HTML to pose
the question, you can remove it again, and then do whatever you want.

I.e., something like:
---
/**
* text : text to display for yes/no answer
* onYes : optional, function called if yes chosen
* onNo : optional, function called if no chosen
* timeout : optional, time in milliseconds before defaulting
* timeoutDefault: optional, default answer for timeout
*
* Don't omit both onYes and onNo.
*/
function myConfirm(text, onYes,onNo,time out,timeoutDefa ult) {
var div = document.create Element("div");
div.style.borde r = "3px grey outset";
div.style.width ="8em";
div.style.heigh t="6em";
div.style.backg round = "grey";
div.style.posit ion = "absolute"; // or use fixed
div.style.left = "10em";
div.style.top = "10em"; // do something to make sure it is visible
var p = document.create Element("p");
p.appendChild(d ocument.createT extNode(text));
div.appendChild (p);
var div2 = document.create Element("div");
div2.style.text Align = "center";
var butYes = document.create Element("input" );
butYes.style.ma rgin="0px 5px";
butYes.type="bu tton";
butYes.value="Y es";
butYes.onclick= function(){acti on(true);};
var butNo = document.create Element("input" );
butNo.style.mar gin="0px 5px";
butNo.type="but ton";
butNo.value="No ";
butNo.onclick= function(){acti on(false);};
div2.appendChil d(butYes);
div2.appendChil d(butNo);
div.appendChild (div2);
div.style.zInde x = 1;
document.body.a ppendChild(div) ;
if (timeout) {
var timer = setTimeout(func tion(){action(t imeoutDefault); },timeout);
}
function action(choice) {
clearTimeout(ti mer);
document.body.r emoveChild(div) ;
if (choice) { if (onYes) {onYes();}}
else { if (onNo) {onNo();} }
}
}
---
You can call it as, e.g.,:
---
myConfirm("Are you sure?",
function(){aler t("yes");},func tion(){alert("n o");},
5000,true);
---
You should do something more to make sure the dialogue is visible, even
if the page is scrolled down.

You can save code space by having the confirm HTML already in the page,
and just changing the actions and text.

/L

Jul 20 '05 #3
Thanks Lasse for your quick answer...i<ll try your solution and let
you know...yeah you<Re right i tried everything to make my confirm
dialog go away after 1 minute and couldn't. So i'm gonna try you way
and see what happens.

For my 1st question, i do have a logout method, is there any way that
i could use this instead of calling session_end() to force the user to
logout when he exits the application???

Thanks a lot once again....

Lasse Reichstein Nielsen <lr*@hotpop.com > wrote in message news:<pt******* ***@hotpop.com> ...
ho*****@yahoo.c om (HolaGoogle) writes:
hi there,
i've 2 questions for you guys....
1: is there any way to "force" a session_onend() , session timeout or
at least call my logout method when a user leaves the application
window without logging out? i.e: using the "X" in the right corner???


No. They might not even be connected to the internet when they close
the browser.
2: I've succesfully been able to ask the user to confirm whether he
wants to extend his session before it ends due to inactivity. This
works perfectly and my question is: if the user is not there to answer
the question is there any way to automaticaly end the session after 1
minutes without any answer???


Probably. Don't use a modal confirm dialog, though. You have no way
of making that go away after one minute. If you use HTML to pose
the question, you can remove it again, and then do whatever you want.

I.e., something like:
---
/**
* text : text to display for yes/no answer
* onYes : optional, function called if yes chosen
* onNo : optional, function called if no chosen
* timeout : optional, time in milliseconds before defaulting
* timeoutDefault: optional, default answer for timeout
*
* Don't omit both onYes and onNo.
*/
function myConfirm(text, onYes,onNo,time out,timeoutDefa ult) {
var div = document.create Element("div");
div.style.borde r = "3px grey outset";
div.style.width ="8em";
div.style.heigh t="6em";
div.style.backg round = "grey";
div.style.posit ion = "absolute"; // or use fixed
div.style.left = "10em";
div.style.top = "10em"; // do something to make sure it is visible
var p = document.create Element("p");
p.appendChild(d ocument.createT extNode(text));
div.appendChild (p);
var div2 = document.create Element("div");
div2.style.text Align = "center";
var butYes = document.create Element("input" );
butYes.style.ma rgin="0px 5px";
butYes.type="bu tton";
butYes.value="Y es";
butYes.onclick= function(){acti on(true);};
var butNo = document.create Element("input" );
butNo.style.mar gin="0px 5px";
butNo.type="but ton";
butNo.value="No ";
butNo.onclick= function(){acti on(false);};
div2.appendChil d(butYes);
div2.appendChil d(butNo);
div.appendChild (div2);
div.style.zInde x = 1;
document.body.a ppendChild(div) ;
if (timeout) {
var timer = setTimeout(func tion(){action(t imeoutDefault); },timeout);
}
function action(choice) {
clearTimeout(ti mer);
document.body.r emoveChild(div) ;
if (choice) { if (onYes) {onYes();}}
else { if (onNo) {onNo();} }
}
}
---
You can call it as, e.g.,:
---
myConfirm("Are you sure?",
function(){aler t("yes");},func tion(){alert("n o");},
5000,true);
---
You should do something more to make sure the dialogue is visible, even
if the page is scrolled down.

You can save code space by having the confirm HTML already in the page,
and just changing the actions and text.

/L

Jul 20 '05 #4
Hi Lasse,

étried your suggestion but it doesn't work for me. my browser doesn't
do anything...well it's ok...i try to fin some other solution....
thanks a lot though!

Lasse Reichstein Nielsen <lr*@hotpop.com > wrote in message news:<pt******* ***@hotpop.com> ...
ho*****@yahoo.c om (HolaGoogle) writes:
hi there,
i've 2 questions for you guys....
1: is there any way to "force" a session_onend() , session timeout or
at least call my logout method when a user leaves the application
window without logging out? i.e: using the "X" in the right corner???


No. They might not even be connected to the internet when they close
the browser.
2: I've succesfully been able to ask the user to confirm whether he
wants to extend his session before it ends due to inactivity. This
works perfectly and my question is: if the user is not there to answer
the question is there any way to automaticaly end the session after 1
minutes without any answer???


Probably. Don't use a modal confirm dialog, though. You have no way
of making that go away after one minute. If you use HTML to pose
the question, you can remove it again, and then do whatever you want.

I.e., something like:
---
/**
* text : text to display for yes/no answer
* onYes : optional, function called if yes chosen
* onNo : optional, function called if no chosen
* timeout : optional, time in milliseconds before defaulting
* timeoutDefault: optional, default answer for timeout
*
* Don't omit both onYes and onNo.
*/
function myConfirm(text, onYes,onNo,time out,timeoutDefa ult) {
var div = document.create Element("div");
div.style.borde r = "3px grey outset";
div.style.width ="8em";
div.style.heigh t="6em";
div.style.backg round = "grey";
div.style.posit ion = "absolute"; // or use fixed
div.style.left = "10em";
div.style.top = "10em"; // do something to make sure it is visible
var p = document.create Element("p");
p.appendChild(d ocument.createT extNode(text));
div.appendChild (p);
var div2 = document.create Element("div");
div2.style.text Align = "center";
var butYes = document.create Element("input" );
butYes.style.ma rgin="0px 5px";
butYes.type="bu tton";
butYes.value="Y es";
butYes.onclick= function(){acti on(true);};
var butNo = document.create Element("input" );
butNo.style.mar gin="0px 5px";
butNo.type="but ton";
butNo.value="No ";
butNo.onclick= function(){acti on(false);};
div2.appendChil d(butYes);
div2.appendChil d(butNo);
div.appendChild (div2);
div.style.zInde x = 1;
document.body.a ppendChild(div) ;
if (timeout) {
var timer = setTimeout(func tion(){action(t imeoutDefault); },timeout);
}
function action(choice) {
clearTimeout(ti mer);
document.body.r emoveChild(div) ;
if (choice) { if (onYes) {onYes();}}
else { if (onNo) {onNo();} }
}
}
---
You can call it as, e.g.,:
---
myConfirm("Are you sure?",
function(){aler t("yes");},func tion(){alert("n o");},
5000,true);
---
You should do something more to make sure the dialogue is visible, even
if the page is scrolled down.

You can save code space by having the confirm HTML already in the page,
and just changing the actions and text.

/L

Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
9510
by: MostlyH2O | last post by:
Hi Folks, I'm having a hard time getting my Session_OnEnd event to fire in my global.asa. Here's what I have: <SCRIPT LANGUAGE=VBSCRIPT RUNAT=Server> SUB Session_OnStart Session.TimeOut = 30 END SUB
8
1689
by: Rune | last post by:
Hi, I'm developing web surveys where users logon to a web survey and answer up to about 50 questions, one after the other, shown only one question at a time. The answers are saved in a database. A fellow developer and I are discussing when is the best time to save the answers. We have two approaches in mind: Approach 1:
12
6385
by: Jim | last post by:
The dreaded Session state :-) All, Just to give a little background this is reagarding an ASP 3.0 application running on IIS6 using the default app pool. I have set the session timeout to 540 minutes in IIS (under options tab in Application configuration). There is no code in the Session_OnStart or Session_OnEnd in the global.asa. Via an...
4
1725
by: Murray Foxcroft | last post by:
Hi all, My client, bless his soul, wants to know how long users of his ASP.NET web application (written by yours truly) spend logged in to the system. Now, I can log when he logs in, no problem, but being disconnected in nature, its hard to trap when then user effectively "closes" the session. He could click a logout button, just close his...
6
7828
by: Weave | last post by:
I would like to redirect to a logout page after a session has timed out. I have placed a response.redirect "loggedoff.asp" in the Session_OnEnd subroutine in the global.asa, but it does not move to the page after timeout occurs. Any suggestions? Thanks in advance ....
11
2993
by: Vishal | last post by:
Hello, can anybody tell me how I can extend the session expiry time? Is it done via code or via IIS? Sorry I am new and dont know about this.
17
5189
by: jensen bredal | last post by:
Hello, i'm struggling with a somehow badly understood session scenario. I provide acces to my pages based on form authentication using Session cookies. Som of my pages are supposed to be running continuously and refreshing once an hour. I there set timeout= 61 in <sessionState section and on my page it says <meta http-equiv="refresh"...
4
1766
by: abcd | last post by:
When IIS is restarted session_onEnd is called. though the debugger is not available at this point in Session_onEnd, is there any way that the code in session_onEnd is running due to iis restart and not from the timeout. thanks
2
3858
by: buu | last post by:
how could I handle session timeout event in asp.net? I would like to perform some action on database when it happens
0
7923
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7852
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8221
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5719
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.