У меня проблема с истечением срока действия файлов cookie.
Хотя я установил срок действия через 3 дня, но печенье
удаляется при закрытии браузера.
Вот мой код.
Private Sub setMyCookie(ByVal username As String)
'------- check for user input; if checkbox is checked on login.
If CheckBox1.Checked Then
'------- check if browser support cookies
If (Request.Browser.Cookies) Then
'------- check if the cookie with name 'myCookie' exists on users machine.
If (Request.Cookies("myCookie") Is Nothing) Then
'------- create a cookie & write username to it
Response.Cookies("myCookie").Value = username
'------- with expiry of 3 days
Response.Cookies("myCookie").Expires = Now.AddDays(3)
'------- write username to the cookie
'Response.Cookies("myCookie").Item("UserLoginName") = username
Else
Response.Cookies("myCookie").Value = username
Response.Cookies("myCookie").Expires = Now.AddDays(3)
End If
End If
End If
End Sub