Clear Cookies
Hi,
I have added the cookies to my page and this works fine (triggered by a checkbox) as per the demo, however when I uncheck the tickbox not to store the cookies they are still saved?
Any help is appreciated.
This is my code:
<%
if (cStr(cStr(Request.Form("remember"))) <> "") then
myExpire = DateAdd("d", 30, Now())
cookieName = "uname"
Response.Cookies(cookieName) = "" & cStr(cStr(Request.Form("useremail"))) & ""
Response.Cookies(cookieName).Expires = myExpire
Response.Cookies(cookieName).Path = "/"
if ("" <> "") then
Response.Cookies(cookieName).Domain = ""
end if
Response.Cookies(cookieName).Secure = 0
end if
%>
<%
if (cStr(cStr(Request.Form("remember"))) <> "") then
myExpire = DateAdd("d", 30, Now())
cookieName = "pname"
Response.Cookies(cookieName) = "" & cStr(cStr(Request.Form("password"))) & ""
Response.Cookies(cookieName).Expires = myExpire
Response.Cookies(cookieName).Path = "/"
if ("" <> "") then
Response.Cookies(cookieName).Domain = ""
end if
Response.Cookies(cookieName).Secure = 0
end if
%>
<%
if (cStr(cStr(Request.Form("remember"))) <> "") then
myExpire = DateAdd("d", 30, Now())
cookieName = "remember"
Response.Cookies(cookieName) = "1"
Response.Cookies(cookieName).Expires = myExpire
Response.Cookies(cookieName).Path = "/"
if ("" <> "") then
Response.Cookies(cookieName).Domain = ""
end if
Response.Cookies(cookieName).Secure = 0
end if
%>
<form id="form1" name="form1" method="POST" action="<%=MM_LoginAction%>">
<table width="450" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="56"> </td>
<td width="302">
<table width="364" border="0" cellpadding="4" cellspacing="0" class="mytable">
<tr>
<td height="25" colspan="3"><legend class="PageHeader">Reviewer Login</legend></td>
</tr>
<tr>
<td width="118" rowspan="4"><img src="images/admin.png" width="118" height="118" /></td>
<td width="58" height="35">Username</td>
<td width="188"><input name="useremail" type="text" id="useremail" value="<%=cStr(Request.Cookies("uname"))%>" /></td>
</tr>
<tr>
<td height="35">Password</td>
<td><input name="password" type="password" id="password" value="<%=cStr(Request.Cookies("pname"))%>" /></td>
</tr>
<tr>
<td height="35"> </td>
<td><input name="remember" type="checkbox" id="remember" value="checkbox" <%If (CStr(cStr(Request.Cookies("remember"))) = CStr("1")) Then Response.Write("checked=""checked""") : Response.Write("")%> />
<label for="remember"></label>
Remember Me</td>
</tr>
<tr>
<td><input type="submit" name="button" id="button" value="Logon" /></td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</form>