Click here to Skip to main content
13,006,180 members (69,857 online)
Click here to Skip to main content
Articles » Web Development » ASP » General » Downloads


34 bookmarked
Posted 22 Aug 2000

Protecting pages with include files

, 14 Sep 2000
An article on how to easily password protect a site using include files
	Dim strUserID
	Dim strPassword
	Dim bLoginOK

	strUserID   = Request.cookies("userID")
	bLoginOK    = false
	'check if the login is ok
	if (Len(strUserID) > 0) then
		'here you should use a database or a COM component				
		bLoginOK = StrComp(strUserID, "CodeProject") = 0
	end if
	'if the login isn't correct redirect to the login page
	if (not bLoginOK) then
		Dim strFile
		strFile = Mid(Request.ServerVariables("SCRIPT_NAME"), _
				InStrRev(Request.ServerVariables("SCRIPT_NAME"), "/") + 1)
		Response.Write "<form name=formLogin action='login.asp' method=post><input type=hidden name=destiny value='" & strFile & "'></form>"
		Response.Write "<script language=JavaScript>"
		Response.Write "document.formLogin.submit();"
		Response.Write "</script>"
	end if		

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


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


About the Author

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

You may also be interested in...

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