MVC OnActionExecuted - session cookie - expire after x minutes of inactivity
The ideal and correct way is to create a class that inherits ActionFlterAttribute and override OnActionExecuting method. Then register it in the GlobalFilters in Global.asax.cs. 

Finally do not use Add but use Set method. Why? Below is from MSDN and explains what the difference is:


  The Set method first checks to see if a cookie already exists in the collection and if so updates it. The Set method does not allow duplicate cookies in the cookie collection. To add duplicate cookies in the cookie collection, use the Add method.