在我的 web.config 中,我将角色管理器配置如下:
<roleManager enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES"
cookieTimeout="30" cookiePath="/" cookieRequireSSL="false"
cookieSlidingExpiration="true" cookieProtection="All">
但是,在我们的自定义 RoleProvider 中,似乎总是调用 GetRolesForUser 方法,而不是像我预期的那样, RoleManager 从其 cookie 中提供角色。
我们正在使用类似的东西来获取用户的角色:
string[] myroles = Role.GetRolesForUser("myuser");
我在配置中或在使用 RoleManager 时是否缺少某些东西