Click here to Skip to main content
15,885,366 members
Articles / Web Development / IIS

Protecting pages with include files

Rate me:
Please Sign up or sign in to vote.
3.86/5 (4 votes)
14 Sep 2000CPOL 137.5K   1.2K   35  
An article on how to easily password protect a site using include files
<%response.buffer=true%>
<html>
<head>
	<title>Protection with Include files
	</title>
</head>

<body>

<!-- Inicio de c�digo ASP -->
<% 
	Dim strUserID
	Dim strPassword
	Dim strURL
	Dim bLoginOK
	Dim bRemember
	
	strURL      = Request.Form("URL")
	strUserID   = request.Form("userID")
	strPassword = Request.Form("password")
	bRemember   = StrComp(Request("remember"), "on") = 0
	
	bLoginOK = (StrComp(strUserID, "CodeProject") = 0) and (StrComp(strPassword, "Password") = 0)	
	 
	if (bLoginOK) then
		Response.Cookies("userID")   = strUserID 'you should replace this with the user ID as a number		
			
		if (bRemember) then
			Response.Cookies("userID").Expires = "12/12/2001"
		end if
			
		Response.Redirect strURL		
	else
		Response.Redirect "AcessDenied.asp"
	end if
		
%>

</body>



</html>

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.

License

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


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

Comments and Discussions