Cookies


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Cookies

  1. #1
    just_me Guest

    Cookies

    Is it the desired method of working with cookies that whenever I write to a
    cookie I must also set the expires property at the same time so that the
    cookie will not be removed from the computer? I kind of thought I would set
    the expires property only on the first page of my website and then change
    the cookies all I wanted on the rest of the pages while the cookie simply
    sits on the user computer waiting for the expiration date. Below is what I
    am getting....

    Page1.asp (file cookie created)
    <%
    Response.Cookies("Data").Expires = DateAdd("d", 1, Now())
    Response.Cookies("Data")("CookiesAvailable")="True"
    %>
    <form name=junk method=post action=Page2.asp>
    <input type=submit name=submit value=Submit>
    </form>


    When Page1 is submitted, Page2 is shown
    Page2.asp (file cookie removed)

    Response.Cookies("Data")("CookiesAvailable")="True"









  2. #2
    Steve Cochran Guest

    Re: Cookies

    I think you have to set the expires per cookie, or else they are not
    persistent.

    steve

    "just_me" <just_me@private.com> wrote in message
    news:397d8475$1@news.devx.com...
    > Is it the desired method of working with cookies that whenever I write to

    a
    > cookie I must also set the expires property at the same time so that the
    > cookie will not be removed from the computer? I kind of thought I would

    set
    > the expires property only on the first page of my website and then change
    > the cookies all I wanted on the rest of the pages while the cookie simply
    > sits on the user computer waiting for the expiration date. Below is what

    I
    > am getting....
    >
    > Page1.asp (file cookie created)
    > <%
    > Response.Cookies("Data").Expires = DateAdd("d", 1, Now())
    > Response.Cookies("Data")("CookiesAvailable")="True"
    > %>
    > <form name=junk method=post action=Page2.asp>
    > <input type=submit name=submit value=Submit>
    > </form>
    >
    >
    > When Page1 is submitted, Page2 is shown
    > Page2.asp (file cookie removed)
    >
    > Response.Cookies("Data")("CookiesAvailable")="True"
    >
    >
    >
    >
    >
    >
    >
    >



  3. #3
    Don Wolthuis Guest

    Re: Cookies


    Hey,

    This is by design and is functioning normally. If you don't specify a expires
    date then the change will be temporary - I believe it will be changed until
    the user closes that browser, could be just for the session.

    Hope this helps,

    _______________________________
    Don R. Wolthuis, MCSD
    Codejunkies.net
    don.wolthuis@codejunkies.net
    Comming Soon...
    http://www.theFutureOfASP.com
    http://www.aspNextGen.com
    2 Sites devoted to ASP+

    "just_me" <just_me@private.com> wrote:
    >Is it the desired method of working with cookies that whenever I write to

    a
    >cookie I must also set the expires property at the same time so that the
    >cookie will not be removed from the computer? I kind of thought I would

    set
    >the expires property only on the first page of my website and then change
    >the cookies all I wanted on the rest of the pages while the cookie simply
    >sits on the user computer waiting for the expiration date. Below is what

    I
    >am getting....
    >
    >Page1.asp (file cookie created)
    ><%
    >Response.Cookies("Data").Expires = DateAdd("d", 1, Now())
    >Response.Cookies("Data")("CookiesAvailable")="True"
    >%>
    ><form name=junk method=post action=Page2.asp>
    > <input type=submit name=submit value=Submit>
    ></form>
    >
    >
    >When Page1 is submitted, Page2 is shown
    >Page2.asp (file cookie removed)
    >
    >Response.Cookies("Data")("CookiesAvailable")="True"
    >
    >
    >
    >
    >
    >
    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center