Click here to Skip to main content
Click here to Skip to main content

Protecting pages with include files

By , 14 Sep 2000
 

Introduction

In this article I will show you how to authenticate users so as to protect pages from being seen without permission. It uses a set of ASP files that will be included to each page that needs protection.

In the example the authetication occurs with a couple of StrComp comparsions, but in real world it should be done using a table or a COM component.

These are the necessary asp files with a explanation of its use:

Login.asp This file ask for the userID and password
LoginCheck.asp This file checks if the userID and password are OK. If so it redirects to the correct page, otherwise it redirects to the Access Denied page
AcessDenied.asp This is the file with the Access Denied message, nothing more
Pages.asp To be able to redirect to the right page after the login I gave each page a unique identifier. So this file has the list of pages and it's identifier. The URL is retrieved from the function GetURLFromNumber
Protector.asp This file must be included in each page that needs protection. Before its inclusion an identifier called nURLID must be declared with the value of the identifier for this page (see Pages.asp).

To see it working click here

More information about include files can be found typing "#include" on the Index page of MSDN.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

xicoloko
Architect VisionOne AG
Switzerland Switzerland
Member
XicoLoko is a brazilian developer based in Switzerland.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Questionwhat should i do with my retrieve data from databasesussvannak15 Jun '03 - 13:35 
GeneralMissing pages.aspmemberSteve C8 Jul '02 - 8:42 
GeneralRe: Missing pages.aspmemberEmelian19 Apr '03 - 1:46 
GeneralMISSING PAGES.ASPmemberDavebond3 Jul '02 - 20:38 
GeneralPages.asp missingmembermike21177 Jun '02 - 9:42 
GeneralPages.asp missingmemberChris Hoskins4 Oct '01 - 12:24 
Generallost navigationmemberAnonymous25 Jan '01 - 5:41 
GeneralTwo CommentssussJames Curran 23 Aug '00 - 7:59 
GeneralRe: Two Commentssussxicololoko23 Aug '00 - 10:31 
GeneralRe: Two CommentssussJames Curran23 Aug '00 - 17:52 
GeneralRe: Two CommentssussTom Wellige23 Aug '00 - 22:25 
GeneralRe: Two CommentssussJames Curran 24 Aug '00 - 10:56 
GeneralRe: Two CommentssussUwe Keim24 Aug '00 - 19:40 
GeneralRe: Two CommentssussTom Wellige24 Aug '00 - 21:01 
GeneralRe: Two CommentssussClaude Vedovini28 Aug '00 - 7:18 
GeneralRe: Two CommentssussTom Wellige29 Aug '00 - 10:19 
GeneralRe: Two Commentssusskarthik18 Sep '00 - 7:25 
GeneralRe: Two Commentssussshabbir karim25 Dec '02 - 23:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web01 | 2.6.130516.1 | Last Updated 15 Sep 2000
Article Copyright 2000 by xicoloko
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid