我想编写一个自定义角色提供者,它有两个其他角色提供者。我写了一个这样的自定义会员提供程序:
public class CustomMemberProvider : MembershipProvider
{
MembershipProvider _sqlProvider = null;
MembershipProvider sqlProvider
{
get
{
if (_sqlProvider == null)
_sqlProvider = System.Web.Security.Membership.Providers["SqlProvider"] as SqlMembershipProvider;
return _sqlProvider;
}
}
MembershipProvider _adProvider = null;
MembershipProvider adProvider
{
get
{
if (_adProvider == null)
_adProvider = System.Web.Security.Membership.Providers["AdProvider"] as MembershipProvider;
return _adProvider;
}
}
....
现在,我也想从 web.config 中获取这两个角色提供者,如下所示:
public class CustomRoleProvider : RoleProvider
{
private static readonly string m_RoleProviderNamePrefix = System.Web.Configuration.WebConfigurationManager.AppSettings["RoleProviderName"] + ":";
RoleProvider _sqlProvider = null;
RoleProvider sqlProvider
{
get
{
if (_sqlProvider == null)
_sqlProvider = ??????
return _sqlProvider;
}
}
RoleProvider _adProvider = null;
RoleProvider adProvider
{
get
{
if (_adProvider == null)
_adProvider = ??????
return _adProvider;
}
}
我找不到任何方法来获得它,请帮助我,谢谢。