开发者

Windows Authentication with custom (my own) RoleProvider don't work on IIS

I try to implement my own RoleProvider:

public class MyRoleManger : RoleProvider
{
    public override bool IsUserInRole(string username, string roleName)
    {
        throw new Not开发者_JAVA技巧ImplementedException();
    }

    public override string[] GetRolesForUser(string username)
    {
        throw new NotImplementedException();
    }
    private string appName = "";
    public override string ApplicationName
    {
        get { return appName; }
        set { appName = value; }
    }
....
}

It is my Web.config:

 <system.web>
       .....
        <roleManager defaultProvider="RoleManger" enabled="true" >
            <providers>
            <clear/>
                <add name="RoleManger" type="UserManager.Client.Web.MyRoleManger" applicationName="MyApp"/>
            </providers>
        </roleManager>

        <authentication mode="Windows"/>
        <identity impersonate="true"/>
    </system.web>

    <system.webServer >
        <security>
            <authorization >
                <clear/>
                <add accessType="Allow" roles="anyRole"/>
                <add accessType="Deny" users="?"/>
            </authorization>
        </security>
        ...
    </system.webServer >

But ASP.NET under IIS don't call MyRoleManager methos. Instead its try get "anyRole" from Windows Security Groups (AD). How to enforce IIS to use MyRoleManager with Windows Authentication?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜