I’ve an ASP.NET MVC blog, in order to show the posts and comments dates in client timezone a cookie is used, the cookie contains the client timezone offset. When the server receives a request it will read the offset value from cookie and changes all the dates accordingly before sending to browser. My question how I can store the cookie in a global variable on every request so that it can be accessed by any where for date adjustment.
Share
You can use a session variable if you don’t want to use the cookie every time
then you can access the session every time needed.
You can also think of implementing e custom modelbinder so you can bind your session’s value to a model. (for example a class UserSettingsModel)