I’m trying to use a prior successful login to a web app to create a cookie that will allow the user to auto-login back to the app if they revisit the site in the next few hours.
My interpretation of the documentation is that setting a cookie with an expiration will return an empty string once that cookie has expired.
Var Expire12Hours As DateTime = DateTime.Now + New DateInterval(0, 0, 0, 0, 0, 15) // Now + 15 seconds for testing
Session.Cookies.Set(“auto_login”, Session.user_id, Expire12Hours)
Then I’m using this cookie in subsequent visits to the site, but it’s always returning the stored value, and not an empty string as I’d expected when it’s expired.
If Session.Cookies.Value("auto_login") <> "" Then System.DebugLog("got here - cookie value: " + Session.Cookies.Value("auto_login")) End If
…no matter how much time passes this cookie is still retrieved and still returns a non-empty string, thus bypassing the whole idea of “expired”. Thanks for any pointers!