关于asp.net:角色提供程序和角色管理

Role provider and Role management

When the CacheRolesInCookie property is set to true in the Web.config file, role information for each user is stored in a cookie. When role management checks to see whether a user is in a particular role, the roles cookie is checked before the role provider is called to check the list of roles at the data source. The cookie is dynamically updated to cache the most recently validated role names.

a)据我所知,即使角色管理检查了角色cookie,角色提供者仍在检查数据源中的角色列表?

b)上面的文本讨论了角色管理,该角色管理在调用角色提供程序之前被调用。什么类充当角色管理?

thanx

编辑:

As far as I understand it, the information cached within the cookie includes all available roles, not just the ones your user is a member of. So I do not believe that the database would be hit each and every time.

与我上一篇文章的引用来自同一网站:

Roles.CacheRolesInCookie Property Value

true if the current user's roles are cached in a cookie; otherwise, false. The default is true.

这表明Cookie中仅存储当前用户的角色。此外,如果所有角色都存储在cookie中,则角色管理器仍将必须检查数据库以查看当前用户是哪个角色的成员?!

Role management is handled by the System.Web.Security.Roles class.

我认为文本使用术语role management来引用调用System.Web.Security.Roles方法的类/模块,该类/模块又检查用户是否是特定角色的成员?


角色管理由System.Web.Security.Roles类处理。据我了解,cookie中缓存的信息包括所有可用角色,而不仅仅是您的用户所属的角色。因此,我认为数据库不会每次都被命中。

如果您要更改可用角色的列表(即通过创建新角色),则提供商将在下一次往返中使cookie中的缓存无效。

//理查德。