I want you to just follow the below mention code because i guess it will give you fair idea regarding the same. I hope that it will help you to develop your own program.
Code:
bLoggedIn = (len(session("UserName")) > 0)
if bRequireLogin then
'Login required
if Not bLoggedIn then
'Not logged in, ask for login
response.redirect "login.asp?comebackto=" & _
request.servervariables("script_name") & "?" & _
server.urlencode(request.querystring)
'Note how we construct the page to come back
end if
end if
%>
login.asp
if request("comebackto") <> "" then
sReferer = request("comebackto")
sGoBackTo = "?" & request.querystring
end if
if request("cmdLogin") <> "" then
'Login Form submitted
sUserName = request("txtUserName")
sPassword = request("txtPassword")
'Check for username and password
if sUserName = "bill" And sPassword = "gates" then
bLoginSuccessful = True
end if
session("UserName") = sUserName
if sReferer = "" then
response.redirect "index.asp"
else
response.redirect sReferer
end if
else
'Display the Login Form
%>
<form action="login.asp<%=sGoBackTo%>" method="post">
<input type="text" name="txtUserName"><br>
<input type="password" name="txtPassword"><br>
<input type="submit" name="cmdLogin"><br>
</form>
<%
end if
%>
testpage.asp
Now, all you need to do is setting bRequireLogin to True and including the security.asp file.
<%
bRequireLogin = True
%>
Bookmarks