How to Write into a Cross-Subdomain Cookie

Discussion in 'ASP General' started by flip79, Oct 25, 2006.

  1. flip79

    flip79 Guest

    Hello and sorry for my english, I'm italian...

    I manage a site with a normal address like: www.mysite.com
    I'm using a cookie to store nicks of my users, with a code like this:
    ----
    Response.Cookies("mycookie").Expires = #January 1, 2030#
    Response.Cookies("mycookie").Path = ""
    Response.Cookies("mycookie").Secure = FALSE
    Response.Cookies("mycookie")("nick") = nick
    ----

    and I'm deleting it, if a user wants so, with:
    ----
    Response.Cookies("mycookie").Expires = #January 1, 2003#
    Response.Cookies("mycookie").Path = ""
    Response.Cookies("mycookie").Secure = FALSE
    Response.Cookies("mycookie")("nick") = ""
    Response.Cookies("mycookie") = ""
    ----
    (I know, there's too much stuff in the delete procedure!)

    Now I'm going to open some new sections of my site, with subdomain
    adresses, like search.mysite.com, shop.mysite.com... and I need that
    cookie authentication for the main (www) address is working also in
    these subdomains.

    I red on the Internet that with the DOMAIN property, I can set my
    cookie to make it work for every subdomain, with something like:
    ----
    Response.cookies("mycookie").domain = ".mysite.com"
    ----

    .... and it works!
    My problem is when I try to DELETE it: after I set a cookie with
    ..domain property, it seems to become "read only": any my attempt to
    delete (or modify) it seems to be ignored.

    Results are the same when I try to write it from the subdomain that
    created it (www), or when I try from the "chief" address (mysite.com,
    without any subdomain).

    Where's my mistake?

    Thanks everybody in advance.
     
    flip79, Oct 25, 2006
    #1
    1. Advertising

  2. flip79

    flip79 Guest

    flip79 wrote:

    > Hello and sorry for my english, I'm italian...
    >
    > I manage a site with a normal address like: www.mysite.com
    > I'm using a cookie to store nicks of my users, with a code like this:
    > ----
    > Response.Cookies("mycookie").Expires = #January 1, 2030#
    > Response.Cookies("mycookie").Path = ""
    > Response.Cookies("mycookie").Secure = FALSE
    > Response.Cookies("mycookie")("nick") = nick
    > ----
    >
    > and I'm deleting it, if a user wants so, with:
    > ----
    > Response.Cookies("mycookie").Expires = #January 1, 2003#
    > Response.Cookies("mycookie").Path = ""
    > Response.Cookies("mycookie").Secure = FALSE
    > Response.Cookies("mycookie")("nick") = ""
    > Response.Cookies("mycookie") = ""
    > ----
    > (I know, there's too much stuff in the delete procedure!)
    >
    > Now I'm going to open some new sections of my site, with subdomain
    > adresses, like search.mysite.com, shop.mysite.com... and I need that
    > cookie authentication for the main (www) address is working also in
    > these subdomains.
    >
    > I red on the Internet that with the DOMAIN property, I can set my
    > cookie to make it work for every subdomain, with something like:
    > ----
    > Response.cookies("mycookie").domain = ".mysite.com"
    > ----
    >
    > ... and it works!
    > My problem is when I try to DELETE it: after I set a cookie with
    > .domain property, it seems to become "read only": any my attempt to
    > delete (or modify) it seems to be ignored.
    >
    > Results are the same when I try to write it from the subdomain that
    > created it (www), or when I try from the "chief" address (mysite.com,
    > without any subdomain).
    >
    > Where's my mistake?
    >
    > Thanks everybody in advance.


    Can't nobody answer? Please help me, I'm still on this problem :(
     
    flip79, Oct 26, 2006
    #2
    1. Advertising

  3. "flip79" <> wrote in message
    news:...
    > Hello and sorry for my english, I'm italian...
    >
    > I manage a site with a normal address like: www.mysite.com
    > I'm using a cookie to store nicks of my users, with a code like this:
    > ----
    > Response.Cookies("mycookie").Expires = #January 1, 2030#
    > Response.Cookies("mycookie").Path = ""
    > Response.Cookies("mycookie").Secure = FALSE
    > Response.Cookies("mycookie")("nick") = nick
    > ----
    >
    > and I'm deleting it, if a user wants so, with:
    > ----
    > Response.Cookies("mycookie").Expires = #January 1, 2003#
    > Response.Cookies("mycookie").Path = ""
    > Response.Cookies("mycookie").Secure = FALSE
    > Response.Cookies("mycookie")("nick") = ""
    > Response.Cookies("mycookie") = ""
    > ----
    > (I know, there's too much stuff in the delete procedure!)
    >
    > Now I'm going to open some new sections of my site, with subdomain
    > adresses, like search.mysite.com, shop.mysite.com... and I need that
    > cookie authentication for the main (www) address is working also in
    > these subdomains.
    >
    > I red on the Internet that with the DOMAIN property, I can set my
    > cookie to make it work for every subdomain, with something like:
    > ----
    > Response.cookies("mycookie").domain = ".mysite.com"
    > ----
    >
    > ... and it works!
    > My problem is when I try to DELETE it: after I set a cookie with
    > .domain property, it seems to become "read only": any my attempt to
    > delete (or modify) it seems to be ignored.
    >
    > Results are the same when I try to write it from the subdomain that
    > created it (www), or when I try from the "chief" address (mysite.com,
    > without any subdomain).
    >
    > Where's my mistake?
    >


    Exact code you are using to create the cookie and exact code you are using
    to delete it would help.

    My guess is that you aren't using .domain = ".mysite.com" when deleting it.


    > Thanks everybody in advance.
    >
     
    Anthony Jones, Oct 26, 2006
    #3
    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. Michael Horton
    Replies:
    1
    Views:
    348
    Michael Horton
    Apr 20, 2004
  2. namespace and subdomain

    , Jun 3, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    373
  3. =?Utf-8?B?QmlsbCBCb3Jn?=

    Implications of subdomain vs. subfolder for web services

    =?Utf-8?B?QmlsbCBCb3Jn?=, Oct 13, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    483
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Oct 14, 2004
  4. saify
    Replies:
    0
    Views:
    886
    saify
    Sep 28, 2009
  5. Connell

    Cross-subdomain javascripting.

    Connell, Jun 28, 2005, in forum: Javascript
    Replies:
    1
    Views:
    91
    Martin Honnen
    Jun 28, 2005
Loading...

Share This Page