扩展RoleProvider GetRolesForUser() [英] Extending the RoleProvider GetRolesForUser()
问题描述
在 GetRolesForUser()
方法 RoleProvider
将用户的登录名,并返回该角色列表用户。但是,在我的应用程序,这是不够的,我需要一些更多的信息才能够得到用户的角色。
The GetRolesForUser()
method in the RoleProvider
takes the user login name and returns the list of roles for that user. But in my application this is not enough, I need a few more pieces of information to be able to get the user's roles.
我怎样才能得到这些额外的信息到方法?
How can I get this extra information into the method?
我有它在会话
,但我发现会话
不可用在 RoleProvider
。
I have it in the Session
, but I found out that Session
is not available in the RoleProvider
.
我有什么在脑海里把一些类扩展的MembershipUser
这个额外的信息,假设我能得到它里面的 RoleProvider
。但我不知道如何创建 CustomMembershipUser
并使它的一部分的MembershipProvider
。这甚至可能?
What I had in mind was putting this extra info in some class that extends MembershipUser
, assuming I can get to it inside the RoleProvider
. But I don't know how to create the CustomMembershipUser
and make it part of the MembershipProvider
. Is this even possible?
最简单的办法就用饼干的是,但我试图保持距离从它。
The easy way out would be using cookies, but I'm trying to keep away from it.
推荐答案
解决这个问题:使用cookie来存储由所需的任何额外信息的 RoleProvider
The solution to this problem: using a cookie to store any extra information needed by the RoleProvider
.
这篇关于扩展RoleProvider GetRolesForUser()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!