PC Review


Reply
Thread Tools Rate Thread

Authenticating against Windows Network: System.DirectoryServices.DirectorySearcher or LogonUser(..) from advapi32.dll?

 
 
Zeno Lee
Guest
Posts: n/a
 
      2nd Mar 2005
I'm trying to authenticate a user against a windows network. I want it to
work across any kind of windows network from NT 4.0 up to Windows 2003 ADS.

So far I've been using DirectoryEntry and DirectorySearcher and doing a
search on Active Directory. With the addition of a customer on an NT 4.0
network, I've had to add DllImport using LogonUser() from advapi32.dll in
addition to the directory search.

To simplify my code, Is it possible to just use LogonUser from advapi32.dll
in any scenario? If LogonUser is called in an Active Directory Network,
does it do a directory search? Is this LogonUser Safe to keep around in
case one of my clients goes to a pure Windows 2003 network?


 
Reply With Quote
 
 
 
 
Joe Kaplan \(MVP - ADSI\)
Guest
Posts: n/a
 
      3rd Mar 2005
LogonUser doesn't use an LDAP search under the hood like the
DirectorySearcher does. However, if you just want to authenticate,
LogonUser will work. It requires that the user actually has rights to logon
locally, but otherwise I'd suggest you use that if you can.

You actually don't need to use the DirectorySearcher to authenticate a user
either. If you want to use LDAP, a bind using the DirectoryEntry is
sufficient.

Joe K.

"Zeno Lee" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm trying to authenticate a user against a windows network. I want it to
> work across any kind of windows network from NT 4.0 up to Windows 2003
> ADS.
>
> So far I've been using DirectoryEntry and DirectorySearcher and doing a
> search on Active Directory. With the addition of a customer on an NT 4.0
> network, I've had to add DllImport using LogonUser() from advapi32.dll in
> addition to the directory search.
>
> To simplify my code, Is it possible to just use LogonUser from
> advapi32.dll in any scenario? If LogonUser is called in an Active
> Directory Network, does it do a directory search? Is this LogonUser Safe
> to keep around in case one of my clients goes to a pure Windows 2003
> network?
>
>



 
Reply With Quote
 
 
 
 
Rhett Gong [MSFT]
Guest
Posts: n/a
 
      3rd Mar 2005
Hi Zeno,
I agree with the answer from Joe.
In addition, if you are developing a ad admin software and user could to
perform operations on AD after being authenticated. using DirectoryEntry
with proper AuthenticationType is a good choice.

For further information, please post to security/AD newsgroup. and we will
follow up you there.

Thanks,
Rhett Gong [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.

 
Reply With Quote
 
Pavel Lebedinsky
Guest
Posts: n/a
 
      3rd Mar 2005
http://support.microsoft.com/default...b;en-us;841699
http://support.microsoft.com/default...b;en-us;180548

"Zeno Lee" wrote:

> I'm trying to authenticate a user against a windows network. I want it to
> work across any kind of windows network from NT 4.0 up to Windows 2003
> ADS.
>
> So far I've been using DirectoryEntry and DirectorySearcher and doing a
> search on Active Directory. With the addition of a customer on an NT 4.0
> network, I've had to add DllImport using LogonUser() from advapi32.dll in
> addition to the directory search.
>
> To simplify my code, Is it possible to just use LogonUser from
> advapi32.dll in any scenario? If LogonUser is called in an Active
> Directory Network, does it do a directory search? Is this LogonUser Safe
> to keep around in case one of my clients goes to a pure Windows 2003
> network?



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Authenticating users against Windows NT User GROUPS Jr. BTS dev! Microsoft ASP .NET 2 27th Jan 2006 03:55 AM
Outlook 2k3 not authenticating properly against pop3 server =?Utf-8?B?Q2hp?= Microsoft Outlook Discussion 2 8th May 2004 06:26 PM
XP Client authenticating against a Linux box DBrown Windows XP Networking 2 15th Oct 2003 10:03 PM
VPN Concentrators authenticating against AD Jerry Warrick Microsoft Windows 2000 Active Directory 0 9th Sep 2003 08:46 PM
How do you figure out the LDAP://? ("Error authenticating. Error authenticating user. The specified domain either does not exist or could not be contacted") mrwoopey Microsoft ASP .NET 3 30th Jun 2003 11:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:26 AM.