更新时间:2023-11-27 23:13:40
我会去存储在窗体身份验证cookie自身的用户的安全令牌。在的FormsAuthenticationTicket
类包含的UserData code>属性,你可以包括你更多的信息。
I would go for storing the security token of the user in the forms authentication cookie itself. The FormsAuthenticationTicket
class contains an UserData
property where you can include your additional information.
在的UserData code>属性指定的值是作为的一部分
认证券cookie并像其他票领域,是
加密和基于验证窗体身份验证系统
配置。
The value specified in the
UserData
property is included as part of the authentication ticket cookie and, like the other ticket fields, is encrypted and validated based on the forms authentication system's configuration.
下面是描述的文章你怎么可以存储更多的信息向窗体身份验证cookie。
Here is an article that described how you can store additional information to the forms authentication cookie.
这是一个很大的文章,解释太多有关存储的其他数据到窗体身份验证。饼干,以及如何你可以读它。在code是用VB写和格式不正确。你必须向下滚动到的第四步:在机票附加存储用户数据的
This is a big article that explains much about storing additional data into the forms auth. cookie and how you could read it. The code is written in VB and not well formatted. You have to scroll down to the Step 4: Storing Additional User Data in the Ticket.
这thread会给你一个快速的解答你怎么可以从cookie阅读的UserData code>。
This thread will give you a quick answer how you could read the UserData
from the cookie.
我会去创建一个自定义 ValueProvider
像描述的的这里将读取从身份验证的安全令牌。饼干和饲料的动作参数。
I would go for creating a custom ValueProvider
like the one described here that will read the security token from the auth. cookie and feed to the action parameters.