CoverYourASP --> Application variables

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
10 active users
1640 visitors today
2375 pages today
how is this done?
Tools I use

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

ASP.NET Blog
RSS submissions
E-commerce

Now open source with SourceForge!

Application variables were under-used on my site, but not for long! I realized recently that a list box that I was populating with data from my database changed very rarely.

So why should every visitor to the site have to cause an identical database query? The simple answer is to take advantage of Application variables. Think of the "Application" in this case being IIS - the server. Once set, Application variables are available to all pages on your site. But it's important to remember that they are gone forever if the server is restarted.

Using Application variables is easy - all you need are statements like:

// to set the data
Application ( 'Data' ) = 'something';

// to use the data
Response.Write ( 'data is ' + Application ( 'Data' ) );

Part 2: Storing HTML...

Featured sponsor
My favorite resources


Qualify for Free Trade Magazines

Free subscriptions to industry leading publications for those who qualify!

CoverYourASP Mugs, T-shirts, caps - even Boxer shorts...
I don't make a penny from these, but they're a lot of fun! Don't you need a new mouse mat?