Index.asp
<%@LANGUAGE="VBSCRIPT"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {color: #0099CC}
.style2 {
font-size: 16px;
font-weight: bold;
}
.style3 {color: #009933}
-->
</style>
</head>
<body>
<div align="center" class="style2">
<h2 class="style3">Preencha nosso Login</h2>
</div>
<form id="form1" name="form1" method="post" action="login.asp">
<table width="400" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td width="53"><span class="style1">Usuario</span></td>
<td width="340"><label>
<input type="text" name="usuario" id="usuario" />
</label></td>
</tr>
<tr>
<td><span class="style1">Senha</span></td>
<td><label>
<input type="password" name="senha" id="senha" />
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="button" id="button" value="Logar" />
</label></td>
</tr>
</table>
</form>
</body>
</html>
Admin.asp
<%@LANGUAGE="VBSCRIPT"%>
<%
If not Session("logado") = true then
response.redirect("erro.asp")
Response.End
End if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {color: #006699}
-->
</style>
</head>
<body>
<div align="center">
<h2 class="style1">Bem vindo a nossa Area restrita </h2>
</div>
<div align="center"><br />
<br />
<a href="sair.asp">Sair</a>
</div>
</body>
</html>
Erro.asp
<%@LANGUAGE="VBSCRIPT"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {color: #0099CC}
.style2 {
font-size: 16px;
font-weight: bold;
}
.style3 {color: #009933}
.style4 {
color: #FF0000;
font-weight: bold;
}
-->
</style>
</head>
<body>
<div align="center" class="style2">
<h2 class="style3">Preencha nosso Login</h2>
</div>
<div align="center" class="style4">
<h4>Usuario ou senha incorretos </h4>
</div>
<form id="form1" name="form1" method="post" action="login.asp">
<table width="400" border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td width="53"><span class="style1">Usuario</span></td>
<td width="340"><label>
<input type="text" name="usuario" id="usuario" />
</label></td>
</tr>
<tr>
<td><span class="style1">Senha</span></td>
<td><label>
<input type="password" name="senha" id="senha" />
</label></td>
</tr>
<tr>
<td> </td>
<td><label>
<input type="submit" name="button" id="button" value="Logar" />
</label></td>
</tr>
</table>
</form>
</body>
</html>
Login.asp
<%@LANGUAGE="VBSCRIPT"%>
<%
Dim usuario,senha
usuario = "admin"
senha = "123456"
If Request.Form("usuario") = usuario and Request.Form("senha") = senha then
Session("logado") = true
Response.redirect("admin.asp")
else
Response.redirect("erro.asp")
End if
%>
Sair.asp
<%@LANGUAGE="VBSCRIPT"%>
<%
If not Session("logado") = true then
response.redirect("index.asp")
End if
Session.Abandon()
response.redirect("index.asp")
%>