my session_onend is not working

A

anand

In my website i want to trace the event when user log off
from the site by closing the explorer so i am unable to
run any server side program at that time and my
session_onend event also not working can any one tell me
why the session_onend is not working.
Thanx in advance
 
K

Kenn Ghannon

Well...can you post the code you're using? That might help....

The Session_End will only NOT fire (as I found out the hard way) if:
1) There is an error in that section of code (it quietly exits instead of
raising error messages)
2) Nothing is stored in the Session
3) You are not using 'InProc' in your sessionstate (in the web.config file).

If you're using Visual Studio, you can set a breakpoint on that section of
code and debug your app -- make sure that your session timeout value (also
in your web.config file) is set to some ridiculously low number (like 1 for
1 minute versus the 20 for 20 minutes that it defaults to)...
 
A

anand

Thanx for your reply
1]I have only one expression in my session_onend event
server.execute("page.aspx")
2] i have sesion variable
3] i am using Inproc

now the problem is if user log off from site by lcosing
the browser window the session_onend event doesn't work.
its working if i execute session.abondan or somthing like
that but it doesn't execute say after automatically after
20 min when user close down the browser
I hope you you understand what i am trying to do.
i just want to track down the user
if it is conncted to site i want to show him online other
wise offline
but if user close down the browser .......
can u help in that
 
C

Chris Becker

I think your problem is with #1 below. Server.Execute executes another
page, but the execute of that page expects there to be valid request and
response objects, which when you hit Session_OnEnd, are not created. You
need to create a class that does the code in "Page.aspx" but doesn't try to
return anything to the httpcontext.current.response or get anything from
httpcontext.current.request.

anand said:
Thanx for your reply
1]I have only one expression in my session_onend event
server.execute("page.aspx")
2] i have sesion variable
3] i am using Inproc

now the problem is if user log off from site by lcosing
the browser window the session_onend event doesn't work.
its working if i execute session.abondan or somthing like
that but it doesn't execute say after automatically after
20 min when user close down the browser
I hope you you understand what i am trying to do.
i just want to track down the user
if it is conncted to site i want to show him online other
wise offline
but if user close down the browser .......
can u help in that
-----Original Message-----
Well...can you post the code you're using? That might help....

The Session_End will only NOT fire (as I found out the hard way) if:
1) There is an error in that section of code (it quietly exits instead of
raising error messages)
2) Nothing is stored in the Session
3) You are not using 'InProc' in your sessionstate (in the web.config file).

If you're using Visual Studio, you can set a breakpoint on that section of
code and debug your app -- make sure that your session timeout value (also
in your web.config file) is set to some ridiculously low number (like 1 for
1 minute versus the 20 for 20 minutes that it defaults to)...





.
 
R

Ram

Anand,
I am just trying to understand your problem. Are you expecting the
Sesion_onEnd to fire immediately after the user closed his browser
window?

Web server will not know even if the user closed his browser window
and only the default time out will occur(20 minutes or your timeout
value). If you want to notify the web server immediately when the user
closes his window, you can launch a popup window in the unload event
of the main window and call the session.abandon in the popup window.

Please let me know if my understanding of your question is wrong.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top