Wife/Girlfriend/Sister?
Pepper Spray &
Stun Gun Specials!
KEEP THEM SAFE.
 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
20 active users
50 visitors today
180 pages today
how is this done?
Tools I use

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

ASP.NET Blog
RSS submissions
E-commerce

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

Tiki Statues - Tiki Masks - Tiki Totems



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

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


I share my content

Supporting ASPRSS

Do you need a quick and easy way to link to my articles? All the information you need is published with ASPRSS...