Re: Cookies
From: Jos (josnospambranders_at_fastmail.fm)
Date: 07/25/04
- Previous message: Guoqi Zheng: "Re: repeater control last row"
- In reply to: Saber: "Cookies"
- Next in thread: M. Posseth: "Re: Cookies"
- Reply: M. Posseth: "Re: Cookies"
- Reply: Saber: "Re: Cookies"
- Reply: wl: "Re: Cookies"
- Messages sorted by: [ date ] [ thread ]
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
- Previous message: Guoqi Zheng: "Re: repeater control last row"
- In reply to: Saber: "Cookies"
- Next in thread: M. Posseth: "Re: Cookies"
- Reply: M. Posseth: "Re: Cookies"
- Reply: Saber: "Re: Cookies"
- Reply: wl: "Re: Cookies"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|