asp.net mvc - Cookies, updating the expiration date on each request in mvc -
I have a fairly simple web app that cookies to store some information about the user and authorize them on each request. uses it. When a user first logs in to the site, a cookie is created and some encrypted information is stored in it, the expiration date is set for the current 24 hours. What I want to achieve is that when the user is moving through a web app, their expiration date is being extended to 24 hours from the present time.
What is the best way to do this? Am I using an attribute on the controller?
You can write a custom action filter which will be executed first, each action reads the cookie from this filter request And sets a new cookie with the same name and value, but with a new expiry date.
Comments
Post a Comment