save settings on browser close

J

Jaco Bregman

Hi all,

I've been trying to save some user settings when the
browser closes, but with little success. What I want to do
is count a users' resource usage, and write it to a
database when the user closes the browser. I tried to use
the 'Session_End' event handler in global.asax, but that
doesn't seem to work.

Any Ideas?
 
C

CJM

Session_OnEnd is very unreliable.

I would also forget about trying to pin down when a user entered the system
and when a user left the system, as you might have done with a traditional
client-server application.

It is much more practical to record what pages a user calls, and when...
You can determine that user left within 20 mins of the last page request
(assuming you leave the default timeout).

What do you mean by resource usage?

Time on the system, I assume?

Chris
 
J

Jaco Bregman

Our website uses a third party Internet service for which
we have to pay. In order to bill our customers for usage
of this service, we count the number of times this service
is used, and store this in a Session object. When the
browser closes, we want to write the usage count to our
database.

If the user leaves our website, can I still retrieve the
information from the session object?

Jaco
 
C

CJM

No. don't use the Session_OnEnd event.

Each time the user access the service, increment the usage count IN THE
DATABASE.

What happens if their machine crashes? What happens if your server crashes?
What do you do if one of the other 101 events that stop your Session_OnEnd
code from running occurs? It will be as if your user has not used the
service at all... in which case, you pay the bills!

Log each use of the service, directly to the DB, immediately before or
immediately after using the service.. (you chose which)

hth

CHris
 
N

news.microsoft.com

hi CJM,
WHY don´t you use trigger on sql server?
take a look at sql server help!
the trigger always starts running when update or delete or insert are
detected in a table.
may be your solution.

REGARDS,
Vilmar
Brazil
 
C

CJM

Hi Vilmar,

First of all the OP might not have access to SQL Server.

Second, I don't see how triggers help in this situation.

Chris
 

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,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top