Wife/Girlfriend/Sister?
Pepper Spray &
Stun Gun Specials!
KEEP THEM SAFE.
 CoverYourASP --> Adding member services --> Part 8

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
54 active users
4049 visitors today
6802 pages today
how is this done?
Tools I use

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

ASP.NET Blog
RSS submissions
E-commerce

Now open source with SourceForge!

Upgrade membership
Ugrading membership, and how I used PayPal to accept payment are the subject of a separate article, to be published soon.

To see the membership upgrade in action, why not upgrade yourself!?!

Members-only area
Providing a members-only area required very little code. First I created a function in Login.asp:

// ============================================
// make sure the user is signed in, and has sufficient access rights
// if not then redirect to passed in page
// ============================================
function NeedAccessLevel ( nLevel, sRedirect )
{
   if ( !IsLoggedIn ( ) )
      Redirect ( 'MemberLogin.asp' );

   if ( nMemberLevel < nLevel )
      Redirect ( sRedirect );
}

The function takes two parameters - the level required and a page to redirect to if the members level is lower than necessary.

Here's how I use it in the exclusive member-only pages - add this code to the top of the page, before the call to Init(), in case the function redirects the user:

// need signed in members of level 2 and above
NeedAccessLevel ( 2, 'MemberUpgrade.asp' );

See what I mean by trying to access a test page that is only available to Gold members - TestAccess.asp.

There's too much code to list, but you can download everything by clicking on the icon.

Featured sponsor
My favorite resources

Tiki Statues - Tiki Masks - Tiki Totems



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...

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?