I have a cookie "IMF" which has the UserID set and the expiration is "End of browsing session".
I created a second cookie "LoginTime" and this cookie updates everytime the user changes pages.
I set the LoginTime cookie expiration after 2min and assigned it to a variable. I want to use this
variable to update the expiration of the IMF cookie.
When I check the browsing session cookies, IMF cookie is successfully updated with the
expiration after 2 mins, but "Response.Cookies("IMF").Expires = ExpireTime" the same statement is directly taking me to the "not logged in" page.
I was expecting to login first and then logout after 2 mins.
Where am I going wrong? Please help
Public Sub CheckLogin()
If Not Request.Cookies("LoginTime") Is Nothing Then
Response.Cookies.Set(New HttpCookie("LoginTime", Now()))
End If
Response.Cookies("LoginTime").Expires = DateTime.Now.AddMinutes(2)
Dim ExpireTime As DateTime = DateTime.Now.AddMinutes(2)
Response.Cookies("IMF").Expires = ExpireTime
Dim strUser As String = ""
If Not IsNothing(Context.Request.Cookies("IMF")) Then
If Not IsNothing(Context.Request.Cookies("IMF")("EDUserID")) Then
strEDUser = Request.Cookies("IMF")("EDUserID")
End If
End If
If strUser = "" Then
Response.Redirect("not.logged.in.aspx")
End If
End Sub