Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Dean Beasley 11 posts 34 karma points
    Feb 10, 2010 @ 23:10
    Dean Beasley
    2

    SetCookie Question

    Hi Everyone!

    I am using the following line of code in my solition: -

     <xsl:value-of select="umbraco.library:setCookie('basket', $newBasketString)"/>

    Question, when will this cookie expire? how can I set a 24 hour timeout on this cookie?

    Thanks in advance

    Regards

    Dean

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Feb 10, 2010 @ 23:24
    Peter Dijksterhuis
    1

    Hi,

    Looking at the code, you can't. It expires in 1 month by default, I didn't see an option to change that.

    HTH,

    Peter

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Feb 10, 2010 @ 23:31
    Morten Christensen
    1

    Hi Dean,

    Just had a quick look through the source code, and the expiration is set to one month:

    cookie.Expires = DateTime.Now.AddMonths(1);

    and you don't have the option to change it via parameters - unfortunatly.

    - Morten

  • Laurence Gillian 600 posts 1219 karma points
    Jul 28, 2011 @ 11:28
    Laurence Gillian
    0

    I would like to see expiration too. 

    Is this something which would be considered as an update maybe for V5 ;)

    Ideally I would love...

    Name, Value, Expires, Path, Domain, Secure, Raw

    This would make me very very very very very happy. 

    Lau

  • Anders Burla 2560 posts 8256 karma points
    Jul 05, 2012 @ 11:19
    Anders Burla
    0

    I think this topic should be alive again for v4.8+ :)

    Agree?

    Kind regards
    Anders

  • Jon Cousins 5 posts 25 karma points
    Feb 14, 2013 @ 21:32
    Jon Cousins
    0

    Agreed.

  • Brian Juul Andersen 44 posts 98 karma points c-trib
    May 17, 2013 @ 10:17
    Brian Juul Andersen
    0

    Agreed !

  • Laurence Gillian 600 posts 1219 karma points
    May 24, 2013 @ 11:44
    Laurence Gillian
    0

    Hello, I've created a ticket in YouTrack for this, comments/thoughts welcomed :)

    http://issues.umbraco.org/issue/U4-2267

    Also, I have no idea why I included RAW on the post above? 

  • Josiah D Thoen 18 posts 63 karma points
    Jun 24, 2013 @ 05:28
    Josiah D Thoen
    0

    Keep in mind, this method is just a helper, you still have full access to use the .net framework to create any cookie you want.  From reviewing the code, it looks like the core used the helper for its own purposes and exposed it so others could use it in their xslt.  Now with razor if you need more control just .net HTTPCookie: http://msdn.microsoft.com/en-us/library/system.web.httpcookie(v=vs.100).aspx

    I would love to work on a project just to get something helpful added but I'm not sure this would be worth spending the time on.  Seems kind of like reinventing the wheel.

Please Sign in or register to post replies

Write your reply to:

Draft