RE: Cookies

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: John Sivilla (JohnSivilla_at_discussions.microsoft.com)
Date: 07/27/04


Date: Mon, 26 Jul 2004 20:43:05 -0700

By default cookies expire when the session expires. In order to persist a cookie for longer than a session, you must explicitly set the expires property to a value in the future.

Hope this helps,
John

"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?
>
>
>