Click here to Skip to main content
15,892,161 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.8K   1.2K   35  
An article on how to easily password protect a site using include files
<%response.buffer=true%> <!-- para habilitar os cookies -->
<html>
<head>
	<title>CodeProject - Login
	</title>
</head>

<!--#include file="Pages.asp"-->

<!-- esse script verifica se foi digitado algo no campo revenda -->
<script language="javascript">
function checkUser() 
{
	if (document.formLogin.userID.value=="")
	{
		alert("Please enter the UserID");
		document.formLogin.userID.focus();
		return false;
	}
	
	return true		
}
</script>

<%	
	Dim strURL	
	strURL = Request.Form("destiny")
	
	if (Len(strURL) = 0) then
		Response.Redirect "AcessDenied.asp"	
	end if
	
%>

<body>

<h1><center>CodeProject</h1></center>
<br>

<form action="LoginCheck.asp" method="post" id=formLogin name=formLogin onSubmit="return checkUser()">

<center>

<br>
<table>
	<tr> <td><h2>Login</h2> </td></tr>

	<tr>
		<table>
		<tr>
			<td>UserID:</td> <td> <input type="text" name="userID" id=userID> </td>
		</tr>
	
		<tr>
			<td>Password:</td>	<td> <input type="password" name="password"> </td>
		</tr>
		
		<tr>
			<td> </td>
			
			<td align=right><input type=checkbox name=Remember>Remember me</td>
		</tr>
		
		</table>
	</tr>
</table>

<br>
<input type=submit  value="OK" name=Submit> 
<input type="reset" value="Clear" id=reset name=reset>
<input type=hidden  value="<%=strURL%>" name=URL>



</center>
</form>

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