Click here to Skip to main content
15,911,646 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: Simple Regular Expression? Pin
neo_605327-Sep-06 0:02
neo_605327-Sep-06 0:02 
GeneralRe: Simple Regular Expression? Pin
_AK_27-Sep-06 0:06
_AK_27-Sep-06 0:06 
GeneralRe: Simple Regular Expression? Pin
neo_605328-Sep-06 15:48
neo_605328-Sep-06 15:48 
GeneralRe: Simple Regular Expression? Pin
_AK_28-Sep-06 23:52
_AK_28-Sep-06 23:52 
AnswerRe: Simple Regular Expression? Pin
just3ala227-Sep-06 22:53
just3ala227-Sep-06 22:53 
QuestionTo make a javascript function execute only at the time of closing a window and not while refreshing Pin
saleemy2ks25-Sep-06 18:15
professionalsaleemy2ks25-Sep-06 18:15 
AnswerRe: To make a javascript function execute only at the time of closing a window and not while refreshing Pin
JUNEYT25-Sep-06 21:35
JUNEYT25-Sep-06 21:35 
GeneralRe: To make a javascript function execute only at the time of closing a window and not while refreshing Pin
saleemy2ks26-Sep-06 2:14
professionalsaleemy2ks26-Sep-06 2:14 
Thank you very much for your reply and sharing your precious time in solving me problem. Please see the description below what actually i am doing in the code and help me.
Actually when the user closes the window(browser) directly without logging out i am killing the user session by executing a javascript function as follows:-


var code;
function getKey(keyStroke) {
// keycode for F5 function
if (window.event && window.event.keyCode == 116) {
//window.event.keyCode = 8;
code=window.event.keyCode;
return true;
}
}

function closeIt()
{
if (code != 116)
{
window.location.href="Default.aspx?action=logout";
}
}


the above javascript function im calling by the following way:-



as when the window will be closing onUnload event and onbeforeunload events will be fired, so in onbeforeunload event i am calling a function CloseIt() which will set the location reference of the page to the Default.aspx which is an login page and there i am checking for the querystring parameter "action" with the value "logout" then i am killing the users session. But the problem is that the onbeforeunload and onunload events will be fired even when we refresh the page. Some how i got succeede to avoid the F5 key as u can see the code above by taking the key of F5 key.
i have already added the line of code you have mentioned:
Response.AppendHeader("Refresh", Convert.ToString(Session.Timeout * 60) +"; URL=Default.aspx?action=logout");

the above line of code will redirect the page to the login page automatically when session expires.

But my problem here is to kill the user session when the user closes the window without logging off and when i am trying to kill the session in the onbeforeunload event of javascript it is even killing the session when we refresh.

So please help me in this how can i over come this problem. Is there any javascript event which will distinghiush window close and refresh. if any please let me know.

Thanks in Advance

Syed Saleem
GeneralRe: To make a javascript function execute only at the time of closing a window and not while refreshing Pin
JUNEYT26-Sep-06 2:56
JUNEYT26-Sep-06 2:56 
Questionbrand new developer of web processes Pin
marsh4425-Sep-06 11:09
marsh4425-Sep-06 11:09 
Questionimage shere Pin
Brent Lamborn25-Sep-06 6:35
Brent Lamborn25-Sep-06 6:35 
AnswerRe: image shere Pin
Guffa25-Sep-06 9:10
Guffa25-Sep-06 9:10 
GeneralRe: image shere Pin
Brent Lamborn25-Sep-06 9:32
Brent Lamborn25-Sep-06 9:32 
AnswerRe: image shere Pin
Guffa25-Sep-06 14:04
Guffa25-Sep-06 14:04 
QuestionPERT/CPM Chart Pin
himanshusharma225-Sep-06 3:26
himanshusharma225-Sep-06 3:26 
QuestionActivex Not Painting Pin
vinodraut25-Sep-06 2:12
vinodraut25-Sep-06 2:12 
Questionadd a password Pin
nirushi24-Sep-06 23:23
nirushi24-Sep-06 23:23 
AnswerRe: add a password Pin
CWIZO25-Sep-06 4:24
CWIZO25-Sep-06 4:24 
QuestionDirectory.Move() Issue Pin
raghbhar24-Sep-06 20:58
raghbhar24-Sep-06 20:58 
AnswerRe: Directory.Move() Issue Pin
Guffa25-Sep-06 2:22
Guffa25-Sep-06 2:22 
AnswerRe: Directory.Move() Issue Pin
sundar15625-Sep-06 12:57
sundar15625-Sep-06 12:57 
Questionrecordcount property Pin
myousufq24-Sep-06 13:55
myousufq24-Sep-06 13:55 
AnswerRe: recordcount property Pin
Guffa24-Sep-06 18:21
Guffa24-Sep-06 18:21 
GeneralRe: recordcount property Pin
myousufq24-Sep-06 19:09
myousufq24-Sep-06 19:09 
AnswerRe: recordcount property Pin
myousufq24-Sep-06 19:36
myousufq24-Sep-06 19:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.