cookie problem, virtual directory related

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
%>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Set cookie in the browser following a Post request 1
strange cookie problem 0
Missing data in cookie 4
cookie related 1
Help with my responsive home page 2
cookie testing 1
Cookie Problems 0
Cookie Problems 1

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top