Cookie. Urgent. Thank You.

Discussion in 'ASP .Net' started by Shapper, May 5, 2005.

  1. Shapper

    Shapper Guest

    Hello,

    I have a Cookie which can have one or many values.
    One of this values is "Culture".

    How can I change the "Culture" value which in inside the cookie?

    This is what I have:
    Dim cookie As HttpCookie = Request.Cookies("MyWebSite")
    If Not cookie Is Nothing Then ' Cookie MyWebSite exists

    ??? NEED to change the existing value of culture from en-US to fr-FR

    Else ' Cookie MyWebSite Does Not Exist

    ' Create Cookie and Add "culture" value to it.

    Dim newCookie As HttpCookie = New HttpCookie("MyWebSite")
    newCookie.Values.Add("culture", "en-US")
    newCookie.Expires = #01/01/3000#
    Response.Cookies.Add(newCookie)

    End If
    Shapper, May 5, 2005
    #1
    1. Advertising

  2. Shapper

    Brock Allen Guest

    Actually this should work:

    > Dim newCookie As HttpCookie = New HttpCookie("MyWebSite")
    > newCookie.Values.Add("culture", "en-US")
    > newCookie.Expires = #01/01/3000#
    > Response.Cookies.Add(newCookie)


    Does it not for some reason?

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen
    Brock Allen, May 5, 2005
    #2
    1. Advertising

  3. If it does, it shouldn't.

    Setting a cookie expiration date for the year 3,000
    is wildly optimistic about the survival time for the
    computer where the cookie is being stored... ;-)




    Juan T. Llibre
    ASP.NET MVP
    http://asp.net.do/foros/
    Foros de ASP.NET en EspaƱol
    Ven, y hablemos de ASP.NET...
    ======================

    "Brock Allen" <> wrote in message
    news:...
    > Actually this should work:
    >
    >> Dim newCookie As HttpCookie = New HttpCookie("MyWebSite")
    >> newCookie.Values.Add("culture", "en-US")
    >> newCookie.Expires = #01/01/3000#
    >> Response.Cookies.Add(newCookie)

    >
    > Does it not for some reason?
    >
    > -Brock
    > DevelopMentor
    > http://staff.develop.com/ballen
    >
    >
    >
    >
    Juan T. Llibre, May 5, 2005
    #3
  4. Shapper

    Brock Allen Guest

    > If it does, it shouldn't.
    >
    > Setting a cookie expiration date for the year 3,000 is wildly
    > optimistic about the survival time for the computer where the cookie
    > is being stored... ;-)


    LOL -- I was speaking about the mechanics. I didn't even notice the date...
    *giggle*

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen
    Brock Allen, May 5, 2005
    #4
    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. Miguel Dias Moura
    Replies:
    2
    Views:
    10,506
    Bruno Sirianni
    Apr 5, 2004
  2. Miguel Dias Moura

    Error with a code line. Urgent. Thank You.

    Miguel Dias Moura, Jun 14, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    282
  3. Miguel Dias Moura
    Replies:
    2
    Views:
    340
    Martin
    Jun 22, 2004
  4. Miguel Dias Moura
    Replies:
    4
    Views:
    3,301
    Miguel Dias Moura
    Jun 23, 2004
  5. Shapper
    Replies:
    2
    Views:
    333
    Juan T. Llibre
    Apr 29, 2005
Loading...

Share This Page