cookie problem, virtual directory related

Discussion in 'ASP General' started by Jaakko T Oksa, Dec 15, 2003.

  1. 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
    %>
     
    Jaakko T Oksa, Dec 15, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Maxwell Hammer
    Replies:
    7
    Views:
    647
    Peter Hansen
    Jun 18, 2005
  2. =?Utf-8?B?SmVmZiBCZWVt?=

    physical path to virtual path under virtual directory

    =?Utf-8?B?SmVmZiBCZWVt?=, Aug 1, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    1,051
    Eliyahu Goldin
    Aug 1, 2007
  3. rockdale

    include virtual in virtual directory?

    rockdale, Sep 3, 2008, in forum: ASP General
    Replies:
    3
    Views:
    445
    rockdale
    Sep 4, 2008
  4. HorseGeek
    Replies:
    2
    Views:
    96
    kaeli
    Apr 5, 2004
  5. Tanja

    cookie related problem...

    Tanja, Jan 27, 2005, in forum: Perl Misc
    Replies:
    3
    Views:
    124
    Sherm Pendley
    Jan 28, 2005
Loading...

Share This Page