ASP Logout Script
I have a simple web page where the user must log-in before viewing any of the pages posted. However, I want them to click the logoff link to clear all cookies and redirect them to another page. Can someone take a look at this and let me know if I'm missing something!!! It looks right to me. Here's my code:
LOG-IN VALIDATE USER CODE:
*************************************************
' execute sql and open as recordset
sqlStr = "Select * FROM usrpssd where username = '" _
& Request.Form("username") & "' and password = '" & Request.Form("password") & "'"
' Opens the returned values from the SQL as a recordset, ready for iteration by ASP
set rcSet = cnStr.Execute(sqlStr)
' validate variables against database
If (not rcSet.BOF) and (not rcSet.EOF) then
response.cookies("validated_user") = frmUsername
response.redirect("/htm/default.asp")
else
response.redirect("/htm/login/error.asp")
end if
%>
************************************************** ***********
LOGOFF USER CODE (this is the code I'm having trouble with):
************************************************** ***********
<%
if response.cookies("validated_user") = frmUsername then
response.cookies("validated_user") = ""
response.redirect("/htm/login/logoff.asp")
end if
%>
webXtreme
__________________
webXtreme
|