views:

15

answers:

1

I have a fairly simple web app that uses cookies to store some information about the user and to authorize them on each request. When the user first logs into the site a cookie is created and some encrypted information is stored in there, the expiration is set for the current time plus 24 hrs. What I want to achieve is that whilst a user is moving through the web app their expiration date is constantly being increased to be 24 hrs from the current time.

What is the best way to do this? Should I be using a attribute on the controller?

A: 

You could write a custom action filter that will execute before each action. This filter will read the cookie from the request and set a new cookie with the same name and value but with a new expiration date.

Darin Dimitrov