Last post Apr 24, 2019 02:00 AM by Wei Zhang
Apr 23, 2019 09:18 AM|kengkit|LINK
Hi guys. The following is my code for successful login.
May i know how can i force logout all the logged-in user by clicking a button? or just logout a specific user? (by system_UID) TQ
Dim myCookie As New HttpCookie("WebtivateUserInCakes")
Apr 24, 2019 02:00 AM|Wei Zhang|LINK
According to your description, firstly you should know that cookie is saved in browser side which means user side but not server.So it is impossible for server to make any changes so that we could delete all the cookies in users' browsers.So in your situation,only
if users click the button, it could remove his own cookie.
You could remove specific cookie by using code as below,you could first create a new cookie which name is same as cookie you want to clear, and set it as null. Lastly , you could add this cookie and it will cover the original cookie.Here is the code ,I hope
it could help you.
Protected Sub Button1_Click(sender As Object, e As EventArgs)
If HttpContext.Current.Request.Cookies("WebtivateUserInCakes") IsNot Nothing Then
Dim aCookie As HttpCookie = HttpContext.Current.Request.Cookies("WebtivateUserInCakes")
aCookie.Expires = DateTime.Now.AddDays(-10)
aCookie.Value = ""