Active Directory的成员资格提供与放大器之间的合并; sqlProvider的放大器、成员、资格、Active

由网友(Exo男神控)分享简介:我一直在问域的asp.net网站的用户和网站的用户之间的合并然而,当我设置的默认成员其中之一ADMembershipProvider要么sqlProvider的我不能访问其他用户I have been asked to merge between the users of domain and the us...

我一直在问域的asp.net网站的用户和网站的用户之间的合并 然而,当我设置的默认成员其中之一 ADMembershipProvider 要么 sqlProvider的 我不能访问其他用户

I have been asked to merge between the users of domain and the users of a web site in asp.net website however when i set the default membership to one of them ADMembershipProvider or SqlProvider I can't access the other users

一样,如果我有域帐户的成员是sqlpro将无法访问该网站,反之亦然

like if i have domain account while the membership is sqlpro it will not be able to access the website and vice versa

我需要的域的所有用户和原始用户的网站的,以便能够访问他们的帐户

I need to make all the users of the domain and the original users of the website to be able to access their accounts

推荐答案

这应该是简单,只需创建自己的MembershipProvider在内部使用两个执行用户验证。

That should be simple, just create your own MembershipProvider which internally uses both to perform user validation.

是这样的:

    public override bool ValidateUser( string username, string password )
    {
        SqlMembershipProvider sql = new SqlMembershipProvider();

        NameValueCollection sqlparameters = new NameValueCollection();
        sqlparameters.Add("param", "value");

        sql.Initialize( "SqlProvider", sqlparameters );

        if ( sql.ValidateUser( username, password ) )
            return true;

        ActiveDirectoryMembershipProvider ad = new ActiveDirectoryMembershipProvider();
        NameValueCollection adparameters = new NameValueCollection();

        adparameters.Add( "param", "value" );

        ad.Initialize( "Ad", adparameters );
        if ( ad.ValidateUser( username, password ) )
            return true;

        return false;
    }
阅读全文

相关推荐

最新文章