ASP/.NET Web Hosting
* 3 Months FREE *
CLICK HERE!
 CoverYourASP --> Application variables --> Part 4

Free membership

Join in the fun! Sign in
Member Services

Site navigation
Download the entire site!
Search my articles
Free Magazines
Browse the directory

Send me feedback
Buy my boxer shorts

Recommend this page
Printer-friendly page

Resources I recommend
Link to my site
Advertising slashed!
About your privacy
Legal stuff
Site statistics
152 active users
3124 visitors today
4688 pages today
how is this done?
ASP.NET Showcase
ASP.NET Graph and Chart Component with FREE developer version

ASP.NET Shopping Cart and E-commerce Control with FREE trial download

ASP.NET Web Hosting with free month and setup

$15 Domain Name Registration from .DNR.
As seen on these sites
Special thanks go to the sites that support me by publishing my articles.
See more

CoverYourASP
Copyright © 1999-2008 James Shaw.
All rights reserved.

ASP.NET Blog
ASPRSS
ShawThing

Now open source with SourceForge!

Then to display the data in the header of every page I use this code in utils/Header.asp:

// lock the application so I can increment page counter
Application.Lock ( );
Application ( 'PagesToday' )++;
Application.Unlock ( );

// display the data
var nUsers = Application ( 'ActiveUsers' ) - 0;
var nUsersToday = Application ( 'UsersToday' ) - 0;
var nPagesToday = Application ( 'PagesToday' ) - 0;
var bRebootToday = Application ( 'NewToday' ) - 0;

Out ( nUsers + ' active user' + ( (nUsers==1) ? '!' : 's' ) + '<br>' );
Out ( nUsersToday + ' visitor' + ( (nUsersToday==1) ? '' : 's' ) + ' today<br>' );
Out ( nPagesToday + ' page' + ( (nPagesToday==1) ? '' : 's' ) + ' today<br>' );

Out ( '<a href="Application.asp">' );

if ( bRebootToday )
   Out ( '(only part of today)' );
else
   Out ( 'how is this done?' );

Incidentally, for those of you not familiar with C or JavaScript, the "?:" syntax in the source code...

Response.Write ( (nUsers==1) ? '!' : 's' );

...is shorthand for writing this:

if ( nUsers == 1 )
   Response.Write ( '!' );
else
   Response.Write ( 's' );

Featured sponsor
My favorite resources

Selling products online - read how James does it now



New Proposal Kit Professional 5.1
Brand yourself as a top professional: create quotes and amazing proposals and get many legal documents free!

The latter saved me 3 times the purchase price on the first day I owned it!


See my source code
wherever you see this icon...

You can also download the entire site source code for FREE!