本文介绍了Active Directory的成员资格提供与放大器之间的合并; sqlProvider的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在问域的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 websitehowever when i set the default membership to one of themADMembershipProviderorSqlProviderI 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;
    }

这篇关于Active Directory的成员资格提供与放大器之间的合并; sqlProvider的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 06:40