J
Jaakko T Oksa
The following script sets,resets or displays the contents of a cookie.
When I place the script in a directory under the iis root, let's
say "mysite" (http://localhost/mysite/tst.asp) it works as expected.
When I create a virtual directory "mysite" and point it to the directory
where the script is, the cookie can no longer be set after it has been
cleared, even though it is accessed in the same location
(http://localhost/mysite/tst.asp)
Anyone know why?
<%
' save this code in tst.asp
If Request("mode")="display" Then
Response.Write "cookie=" & request.cookies("cookie") & "<br><br>"
End If
If Request("mode")="set" Then
Response.Cookies("cookie") = "12345"
Response.Cookies("cookie").Expires = DateAdd("d", 2, Date)
Response.Cookies("cookie").Path = "/"
End If
If Request("mode")="clear" Then
Response.Cookies("cookie") = ""
End If
%>
<a href="tst.asp?mode=display">display cookie</a><br>
<a href="tst.asp?mode=set">set cookie</a><br>
<a href="tst.asp?mode=clear">clear cookie</a>
<%
' end
%>
When I place the script in a directory under the iis root, let's
say "mysite" (http://localhost/mysite/tst.asp) it works as expected.
When I create a virtual directory "mysite" and point it to the directory
where the script is, the cookie can no longer be set after it has been
cleared, even though it is accessed in the same location
(http://localhost/mysite/tst.asp)
Anyone know why?
<%
' save this code in tst.asp
If Request("mode")="display" Then
Response.Write "cookie=" & request.cookies("cookie") & "<br><br>"
End If
If Request("mode")="set" Then
Response.Cookies("cookie") = "12345"
Response.Cookies("cookie").Expires = DateAdd("d", 2, Date)
Response.Cookies("cookie").Path = "/"
End If
If Request("mode")="clear" Then
Response.Cookies("cookie") = ""
End If
%>
<a href="tst.asp?mode=display">display cookie</a><br>
<a href="tst.asp?mode=set">set cookie</a><br>
<a href="tst.asp?mode=clear">clear cookie</a>
<%
' end
%>