I am using 2005 Beta 2 with the following code:
But it always hits that line of code when I refresh the page...surely 20min lifespan is long enough. The cookie is always NOTHING when I refresh the page.VB Code:
Private Const SECURITY_COOKIE As String = "Security" Private Const GUID_KEY As String = "GUID" Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim Cookie As HttpCookie = Request.Cookies.Item(SECURITY_COOKIE) Dim Passed As Boolean If Not (Cookie Is Nothing) Then Dim GUID As String = Cookie.Item(GUID_KEY) If GUID = String.Empty Then CreateSecurityCookie() Else Passed = True End If Else 'always this line...always :o( CreateSecurityCookie() End If Dim Woof As HttpCookie = Request.Cookies.Item(SECURITY_COOKIE) If Woof Is Nothing Then 'never here as it's just been created above, so of course it exists Passed = False End If End Sub Private Sub CreateSecurityCookie() Dim NewCookie As New HttpCookie(SECURITY_COOKIE) Dim dt As DateTime = DateTime.Now Dim ds As New TimeSpan(0, 0, 20, 0) NewCookie.Expires = dt.Add(ds) NewCookie.Item(GUID_KEY) = "Woof" Request.Cookies.Add(NewCookie) End Sub
How come it doesn't remember the cookie?
Am I being daft?
Woof




Reply With Quote