469,926 Members | 1,526 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

cookie problem, virtual directory related

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
%>
Jul 19 '05 #1
0 1717

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Jaakko T Oksa | last post: by
28 posts views Thread by Jon Davis | last post: by
7 posts views Thread by Jaydeep | last post: by
3 posts views Thread by rjoseph | last post: by
3 posts views Thread by =?Utf-8?B?YzY3NjIyOA==?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.