ASP JEmail Password Protected

Example ASP script for password protecting pages.

To password protect a directory you can use the following method:

Create a page called index.asp as follows (replace guest and login with your own username and password)...
<%
msg = ""
If Request("Submit") <> "" Then
If Request("username") = "guest"
And Request("password")="login" Then
Session("Valid") = Request("username")
'first protected page here
response.redirect "nextpage.asp"
Else msg = "Invalid username or password. Try again!"
End If
End If
%>
<html>
<head>
<title>Password Protect</title>
</head>
<body>
<form action="index.asp" method="post">
<table>
<% If msg <> "" Then %>
<tr><td colspan="2"><font color=red><%=msg%></font></td></tr>
<%End If%>
<tr>
<td>UserName:</td>
<td><input type="text" name="UserName"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="Password" name="Password"></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="Submit"></td>
</tr>
</table>
</form>
</body>
</html>

On top of every ASP page you want to protect in the directory add the following function...
<%
If Session("Valid") = "" Then
Response.redirect "index.asp"
End If
%>
Any page with this in it will not allow the user to view it unless they are logged in!

Parts in bold need to be changed to suit your needs
E-mail : sales at virtualsplat dot com

Phone : +91 022 28067978