Active Directory Exceptions

Hello there experts,

I have a question about active directory and the exceptions that can be thrown when an error or errors occur when trying to login to active directory passing a username and password, valid or not. The reason why I am looking for a list of the possible exceptions is because currently, the code that we have in VB.NET (which unfortunetly I cannot post, against company policy and I am being monitored), actually takes a username and password and tries to authenticate it with Active Directory. Basically what is being returned is a COMException, anytime that there is an error that has occurred. My initial thought is that the code that comprises Active Directory is not .NET compliant yet, thus is not throwing exceptions but regular old errors. Plus, in our login script, we want to be able to track any exceptions or errors that occur, so that we can handle them appropriately. An example of this is if a person provide a valid username and password, but their account is about to expire, we will receive the COMException, which basically is returning that the password is about to expire, but the login was successful. We do not want to not allow the user to login to our app just because their password is about to expire.

So what I am looking for, if possible, is a list of possible Active Directory exceptions that can be thrown; or a way to suck out the actual cause of the exception out of the basic COMException being returned back. My team and I have been unable to find any documentation on how to find any of this info, so I am leaving it to the experts. Thanks in advance for the help and patience.

slimbx
slimbxAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

slimbxAuthor Commented:
Specifically, I am looking for the HResult codes and descriptions of the errors that are being returned via DirectoryServices, so that I can specifically identify when I get a COMException, exactly what the exception means errorwse, so that I can write code to accomodate accordingly. Hope this helps more. Thanks

-slimbx-
ihenryCommented:
You can get somewhat useful information from this link and that might be the best documentation you could find in internet.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/adsi_error_codes.asp

But honestly, it sucks and it doesn't really provide details on what the nature of the error.

And there isn't really an easy way to determine what causes AD authentication to fail as that could be caused of myriads of reasons. For example, wrong user name or password, or the user account is disabled or the password has expired, etc.
From my experience by far, the only way is to write code that manually check in case by case basis from the related attributes (userAccountControl, pwdLastSet, etc) before the actual authentication take place.

HTH
Henry

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
slimbxAuthor Commented:
ihenry,
My team and I have seriously exhausted that link that you sent. :)  Thats a good thing, we just want to tak it to the next level. One thought that we had though, was installing Win 03 server, and trying to locate the MFC header file that stores the result information regaring ADSI. If that doesnt work, I am fearing the worst. REWRITE THE CODE!!!!!!!!!!!!!!!!!!!!!!!!

slimbx
slimbxAuthor Commented:
ihenry, since you were the first to respond and the mediators are going to abandon my account, I thought you deserve the points. Thanks for your help.

slimbx
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.