Welcome to Part 4 of our tutorial...
As simple as that!
In this
logout.asp page, as I've mention earlier, it only perform a function, or a line of code to cleared the session variable!
There is another way of captured or storing the user input into a variable, but in this tutorial, I will show you using session variable.
- Code: Select all
<%
Session.Abandon
Response.Redirect("login.asp")
%>
If you recall in the previous tutorial, I have use this code in my
success.asp page to validate or block any unregistered user to access the success.
asp page.
- Code: Select all
<%
'This will make sure no user can access this page without login into the system first,
'If the user type this page address directly into the browser, they will be redirected into the login page!
If Session("name") = "" Then
Response.Redirect("login.asp")
End If
%>
Somewhere in our
verify.asp page, we have set the session variable value to the entered username so that when we access the
success.asp page, we will not be redirected to the main page.
The session variable value is equal to our username:-
- Code: Select all
<%
'Assign Session variable value to the entered username for login security!
'Once you Log Out, the session value will be cleared off in the logout.asp page!
Session("name") = Request.Form("txtUsername")
%>
Well, in this logout.
asp page, we will cleared off the session value to empty "" using the code
"Session.Abandon"
When somebody try to access the
success.asp page(by typing the address directly into the browser), they will be redirected back to the main page asking them to login first!
That's it!
You have successfully logged off from this page!
In the next tutorial, we will be discussing on the create.asp page where we will create a new user to use/being able to login into this system/page.