Recently, I was working on a project for a customer. The user asked the website to enable single-point login for domain users, instead of entering the user name and password for login. Obviously, the traditional website is set as a basic identity authentication (domain authentication), and the cancellation of anonymous authentication cannot meet the requirements. Is there another way? There are some methods that allow access by both Domain Users and non-Domain Users, and have undergone basic form verification. You can write a shared method. The input parameter is the domain user name and password, and the domain user verifies validity. In this way, the domain user has a user name and two sets of passwords.
The common method is written as follows:
Public Bool Checkdomainuser ( String UID, String PWD)
{
Bool Flag1;
Try
{
If (PWD = Null | PWD. Trim (). Length = 0 )
{
Return False;
}
String Spath = " LDAP: // bqc.corp.com " ;
Directoryentry entry1 = New Directoryentry (Spath, uid, PWD, authenticationtypes. serverbind );
Object Obj1 = System. runtime. compilerservices. runtimehelpers. getobjectvalue (entry1.nativeobject );
Flag1 = True ;
}
Catch
{
Flag1= False;
}
Return Flag1;
}