Because Master page plays as a server control of content page at runtime, If you exchange between different content pages that reference to the same master page, acturlly the whole page has changed. Therefore the whole page life cycle has come through when you exchange between different content page.
So, it hard to determin whether a user left the web application only on one page. I think one approach may solve your problem, although may not be the best one, using frameset. That means create a frameset( the html and script code like the below), and in this frameset page write the code to handle of exiting the page. Because this frameset page is the most outside page that holds other pages in its frame, when user leave this page, he must left the application.
<html>
<head>
<script type="text/javascript">
<!--
window.onunload = function()
{
window.open ("Pop.htm");
}
//-->
</script>
</head>
<script type="text/javascript">
<!--
var sHtml = '<frameset rows="*,100%" border=0>' +
' <frame name="index" id="index" src="AnyInexistentPage.htm" frameborder=0>' +
' <frame name="template" id="template" src="../test4/Default2.aspx"'+ location.search +'" frameborder=0 noresize scrolling=no>' +
' </frameset>';
document.write(sHtml);
//--></script>
</html>
Johnson