Maintaining state in Asp.Net MVC website

前端 未结 2 1223
一个人的身影
一个人的身影 2021-01-22 12:51

I\'m currently designing a new website built on MVC and I wonder what is the right way to manage state.
The state should contain the userId and some structs of the user info

2条回答
  •  春和景丽
    2021-01-22 12:58

    If you are using .NET 4.5 and dependent on the type and amount of information you are keeping on users you may want to look at using claims to store information about the user. In .NET 4.5 all Principals inherit from ClaimsPrincipal. ClaimsPrincipal already uses claims to store the user name, roles and other information. You can create your own service to transform claims, which will allow you to add additional information to the Principal user.

提交回复
热议问题