Urgent- Authentication with Active Directory

  • Thread starter Thread starter MJ
  • Start date Start date
M

MJ

Hi,
I'm trying to authenticate a user by creating a
DirectoryEntry using the contructor with signature

Dim objEntry = New DirectoryEntry(path, username, pwd).

and then i check for

If Not objEntry is Nothing then ... to continue processing

When a correct username/pwd is passed, everything works
fine. The problem is when an Invalid Username/pwd is
supplied.

objEntry is returned as an object so well it's
not 'Nothing'. Trying to access the underlying
NativeObject results in an exception. There are private
properties(Bound) and methods (adsobject) which could be
of help but since they are private, they cannot be
accessed. Could somebody please help me with how I could
check if the DirectoryEntry object returned is truly
bound and valid?

Thanks,
MJ
 
Why don't you just try catch around it? If it's valid, then it won't throw
an exception, if it's invalid then it will and you can deal with it in the
catch block.

Josh Moody
VSU Team

--

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
--------------------
 
Thanks for the response. Yes, that's what I'm doing right
now but still think that this isn't the most elegant way
to deal with it.
I'm not sure how expensive it is to raise exceptions
everytime it reads as invalid though but will try and get
more info on it. For now, I guess I don't have much of a
choice.

Lakshmi
 
Back
Top