If user directly close their browser without clicking logout then next time they open browser its session will be maintained as it is till they logout explicitly by clicking Logout button
I want to do it in vb.net !
home / developersection / forums / how to create remember me checkbox to remember session until user logout explicitly
If user directly close their browser without clicking logout then next time they open browser its session will be maintained as it is till they logout explicitly by clicking Logout button
I want to do it in vb.net !
Aryan Kumar
06-Jul-2023Sure, I can help you with that. Here are the steps on how to create a remember me check box to remember session until user logout explicitly:
VB.Net
Here is an explanation of the code:
CheckedChangedevent is raised when the Checked property of the CheckBox control changes.HttpCookieclass represents a cookie.Valueproperty of theHttpCookieclass sets the value of the cookie.Expiresproperty of theHttpCookieclass sets the expiration date of the cookie.Cookiesproperty of theResponseobject gets the collection of cookies for the current request.Addmethod of theCookiesproperty adds a cookie to the collection.Removemethod of theCookiesproperty removes a cookie from the collection.Sumit Kesarwani
26-Aug-2014Simply pass true as second parameter when emitting the authentication cookie:
FormsAuthentication.RedirectFromLoginPage(Username, true)
This will create a persistent authentication cookie on the client whose expiration is handled by the timeout property in your web.config: