CoverYourASP --> Rotate banners

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
26 active users
4124 visitors today
3468 pages today
how is this done?
Tools I use

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

ASP.NET Blog
RSS submissions
E-commerce

Now open source with SourceForge!

See that extra content on the right of this page? Refresh the page and you'll see that different items are displayed in a different order each time. (Actually, the one or two top items may not change - they are reserved for advertisers)

This shows a good use (maybe the only one) of JavaScript's Math.random() function. Using this and a couple of arrays it's a snap to provide functionality like this.

Just as on most of my pages I don't have enough space to show all my links, so I can pass into the ShowBanners function the number to display.

(If you do want to see all the links on a page reserved for just for them, go here).

The banners are stored in my database (in the MyBanners table), and the contents copied into Application variables at the start of each day.

This method is perfect for banners - they change rarely, but are displayed often (on virtually every page), so the speed and scalability of Application variables has a huge effect. Read more about this process in this article.

Featured sponsor
My favorite resources


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

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


Qualify for Free Trade Magazines

Free subscriptions to industry leading publications for those who qualify!