By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,617 Members | 1,792 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,617 IT Pros & Developers. It's quick & easy.

Urgent- Authentication with Active Directory

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.
--------------------
Content-Class: urn:content-classes:message
From: "MJ" <an*******@discussions.microsoft.com>
Sender: "MJ" <an*******@discussions.microsoft.com>
Subject: Urgent- Authentication with Active Directory
Date: Fri, 9 Jan 2004 12:19:01 -0800
Lines: 25
Message-ID: <03****************************@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Thread-Index: AcPW7dHJA0xlfVtnT92p3+U1IJstjw==
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Newsgroups: microsoft.public.dotnet.languages.vb
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.languages.vb:171614
NNTP-Posting-Host: tk2msftngxa09.phx.gbl 10.40.1.161
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

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


Nov 20 '05 #2

P: n/a
MJ
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

-----Original Message-----
Why don't you just try catch around it? If it's valid, then it won't throwan exception, if it's invalid then it will and you can deal with it in thecatch block.

Josh Moody
VSU Team


Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.