Can't Fire Event when User Leaves Page

This can only be done using a client-side scripting language, such as JavaScript. This can not be done directly from ASP.NET.
Code:
<body onunload="java[b][/b]script:alert(This page is unloading.)">
 
Okay... time to get explanatory. Im attempting to include a section on my website that displays users currently logged on, and the number of guests that are on the site. I have a DB setup with the appropriate fields, and have no problem populating them (adding a guest upon opening the site, adding a user thats logged in to my list), but rather unpopulating/updating them upon the user leaving.

Ive seen this done in many PHP sites, and some .NET, but dont know how to do it myself. Should this be a global.asax thing? Ive yet to do a project with global.asax, and this is probably a good time to start. Please let me know.

the website is http://www.JoshAndBrandi.com/NEW/

feel free to take a look and provide any other constructive criticism. BTW, this site is going to be 100% text/css - NO PICTURES. Im attempting to provide a VERY speedy product for people that are even on dial-up.

Thanks!!!
 
Youre going about this the wrong way. Instead of looking for an event (the web is a stateless environment, no matter how much one would like it otherwise) that signifies a user leaving, keep track of when they have been there. Each time a user visits a page update a "LastActivity" field in your database with the current date and time. Then, on your "whos online" page, query for those users who have been active within the last 15 minutes or so.
 
Im attempting to provide a VERY speedy product
You might want to get rid of all your table elements, in favor of layers, remove the useless font tags you have in there and transfer the majority of your tag attributes to their CSS equivalents.
 
are layers really more efficient than tables?
and do layers work properly on non-IE browsers??

(Probably wrong forum for these kinds of questions, but they seemed relevant to the thread....)
 
Actually, After looking into Layers, I cant say that theyre necessarily any more efficient than tables. I know tables take time to render, but cmon - what doesnt? And for the end result I want, I dont see an efficient way to implement layers.
 
Back
Top