ASP.NET MVC TempData in browser cookie

后端 未结 3 670
醉梦人生
醉梦人生 2021-01-13 08:41

I am trying to use a custom ITempDataProvider provider to store TempData in a browser\'s cookie instead of session state. However, everythi

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-13 09:10

    There is a better solution by Brock Allen on GitHub that uses encryption, 2 forms of serialization, and compression to protect and optimize the cookies.

    https://github.com/brockallen/CookieTempData

    Here is a link to the blog about it:

    http://brockallen.com/2012/06/11/cookie-based-tempdata-provider/

    He also has a good technique using IControllerFactory to ensure every controller is supplied with an instance of ITempDataProvider.

提交回复
热议问题