Re: Cookies

From: Jos (josnospambranders_at_fastmail.fm)
Date: 07/25/04

  • Next message: Alan Roberts: "Re: Relative URL"
    Date: Sun, 25 Jul 2004 09:45:10 +0200
    
    

    Saber wrote:
    > I want to prevent users from voting more than 1 time in a simple poll.
    > I tried:
    >
    > Session.Timeout = 40
    >
    > Dim objCookie As HttpCookie
    > objCookie = New HttpCookie("before", "voted")
    >
    > If Session("before") = "" And Request.Cookies("before") Is Nothing
    > Then Session("before") = "voted: true"
    > Response.Cookies.Add(objCookie)
    > ...
    >
    > But the If block runs again when I close and open page, then
    > re-submit the form, I mean Request.Cookies("before") Is Nothing
    > always is Nothing!
    > why? what I've to do?

    You need to set an expiration time to the cookie to make it
    a persistent cookie.
    If you don't, the cookie will be a session cookie, and it
    will expire with the session.

    objCookie.Expires = Date.Now().AddDays(30)

    -- 
    Jos
    

  • Next message: Alan Roberts: "Re: Relative URL"

    Relevant Pages

    • Re: ADFS Token Auth clarification
      ... cookie is a session cookie, ... Session cookies are shared across a browser process. ... Windows opened by that process. ...
      (microsoft.public.windows.server.active_directory)
    • Re: CSS, CSS & let me give you some more CSS
      ... I think we are getting away from the original topic, CSS and how it effects ... Basically the general agreement is that cookie stealing via embedded code is ... >> In this case the best protection is to change session cookie ...
      (Vuln-Dev)
    • Re: CSS, CSS & let me give you some more CSS
      ... > I think we are getting away from the original topic, CSS and how it effects ... > Basically the general agreement is that cookie stealing via embedded code is ... >>> In this case the best protection is to change session cookie ...
      (Vuln-Dev)
    • LWP cookies
      ... The cookies header contains a bunch of stuff, ... cookie" that expires. ... That is the cookie and value when this code was originally got (some ... Clearly some current correct session cookie is being sent and all ...
      (comp.lang.perl.misc)
    • Re: FormsAuthentication & createPersistentCookie
      ... ASP.NET will create a persistent cookie or session cookie for the ... authentication ticket is stored in client-side cookie by default. ...
      (microsoft.public.dotnet.framework.aspnet.security)