Best practice for persisting User State in special kind of Asp.Net Mvc application

后端 未结 1 918
清酒与你
清酒与你 2020-12-06 15:30

I will try to explain my situation and what I wanted to do. There is not any difficult and rare situation, but I can\'t find any relative questions or articles in internet.<

相关标签:
1条回答
  • 2020-12-06 15:55

    Use your own concept of a persistent session that is identified by a hidden input on the page and does not expire, or at least does not expire for a very long time. Have all of your controllers derive from a single base controller and use the OnActionExecuted to add the session "key" to the ViewBag when the result is a ViewResult (you won't need it for partial views or JSON, etc). Every page can then access the ViewBag and create the hidden input - probably you want to use a partial view for this and simply include the partial on every page. Store the data associated with this session in the database.

    0 讨论(0)
提交回复
热议问题