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
Cannot create a Virtual Directory using System.DirectoryServices on Windows Vista RC1 fredfrog22@hotmail.com Microsoft C# .NET 1 5th Oct 2006 11:25 AM
LogonUser timeout when disconnected from network serban.lascu@gmail.com Microsoft Dot NET 0 11th May 2006 02:33 PM
unhandled exeption of type 'System.Runtime.InteropServices.COMException' in system directoryservices.dll cgian31 Microsoft C# .NET 5 7th Jan 2006 04:12 PM
Authenticating to windows XP home computer over network Windows XP Networking 0 29th Dec 2003 08:50 AM
DirectoryServices.DirectorySearcher dave Microsoft ASP .NET 0 16th Dec 2003 06:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:42 PM.