473,386 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

"Sudden" Active Directory error on ASP.NET

I have an ASP.NET page that searches for someone in the corporate Active
Directory.

It had been working fine until recently when I changed from Basic
Authentication on IIS6 back to Integrated Windows authentication. The error
occurs on the FindAll method. The exceptions are as follows. anyway of
getting the code working with Integrated Windows authentication (too annoying
for user to enter user-name/password). Note I do need to use impersonation
(to figure out the username of the logged on user)

Exception:
System.Runtime.InteropServices.COMException (0x80072020): An operations
error occurred
at System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObj ect()
at System.DirectoryServices.DirectorySearcher.FindAll (Boolean
findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindAll ()
at MyCompany.it.myApp.BUMaintenance.FindMgrBtn_Click( Object sender,
EventArgs e)

Web.config:
<authentication mode="Windows" />
<identity impersonate="true" />

Code snippet below:

DirectoryEntry dirEntry = new
DirectoryEntry("LDAP://dc=myDept,dc=myCompany,dc=com");
DirectorySearcher dirSearcher = new DirectorySearcher( dirEntry );
dirSearcher.Filter = "(&(SN="+ LastnameTxt.Text + "*)(givenName="+
FirstnameTxt.Text +"*)(l="+ LocationTxt.Text +"*))";
System.DirectoryServices.PropertyCollection objectPropperties;
foreach (SearchResult resultEntry in dirSearcher.FindAll())
{
//display results
}
Nov 19 '05 #1
9 3156
I have read some articles which suggest that I need to turn on "Kerberos"
authentication (in order for token to be passed to Active Directory for
authentication).

How could I turn on Kerberos authentication? It is not an option in IIS6 on
Windows server 2003. Note I am using Integrated Windows authentication at
present.

"Patrick" wrote:
I have an ASP.NET page that searches for someone in the corporate Active
Directory.

It had been working fine until recently when I changed from Basic
Authentication on IIS6 back to Integrated Windows authentication. The error
occurs on the FindAll method. The exceptions are as follows. anyway of
getting the code working with Integrated Windows authentication (too annoying
for user to enter user-name/password). Note I do need to use impersonation
(to figure out the username of the logged on user)

Exception:
System.Runtime.InteropServices.COMException (0x80072020): An operations
error occurred
at System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObj ect()
at System.DirectoryServices.DirectorySearcher.FindAll (Boolean
findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindAll ()
at MyCompany.it.myApp.BUMaintenance.FindMgrBtn_Click( Object sender,
EventArgs e)

Web.config:
<authentication mode="Windows" />
<identity impersonate="true" />

Code snippet below:

DirectoryEntry dirEntry = new
DirectoryEntry("LDAP://dc=myDept,dc=myCompany,dc=com");
DirectorySearcher dirSearcher = new DirectorySearcher( dirEntry );
dirSearcher.Filter = "(&(SN="+ LastnameTxt.Text + "*)(givenName="+
FirstnameTxt.Text +"*)(l="+ LocationTxt.Text +"*))";
System.DirectoryServices.PropertyCollection objectPropperties;
foreach (SearchResult resultEntry in dirSearcher.FindAll())
{
//display results
}

Nov 19 '05 #2
Alternatively, is it at all possible to use another (hard-wired) user's
credentials to authenticate into Active Directory. When I say, hard-wired
user, I mean a fixed user that is different from the logged on user (note, I
need to use impersonation to figure out from Environment.Username the
username of the logged on user).

"Patrick" wrote:
I have read some articles which suggest that I need to turn on "Kerberos"
authentication (in order for token to be passed to Active Directory for
authentication).

How could I turn on Kerberos authentication? It is not an option in IIS6 on
Windows server 2003. Note I am using Integrated Windows authentication at
present.

"Patrick" wrote:
I have an ASP.NET page that searches for someone in the corporate Active
Directory.

It had been working fine until recently when I changed from Basic
Authentication on IIS6 back to Integrated Windows authentication. The error
occurs on the FindAll method. The exceptions are as follows. anyway of
getting the code working with Integrated Windows authentication (too annoying
for user to enter user-name/password). Note I do need to use impersonation
(to figure out the username of the logged on user)

Exception:
System.Runtime.InteropServices.COMException (0x80072020): An operations
error occurred
at System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObj ect()
at System.DirectoryServices.DirectorySearcher.FindAll (Boolean
findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindAll ()
at MyCompany.it.myApp.BUMaintenance.FindMgrBtn_Click( Object sender,
EventArgs e)

Web.config:
<authentication mode="Windows" />
<identity impersonate="true" />

Code snippet below:

DirectoryEntry dirEntry = new
DirectoryEntry("LDAP://dc=myDept,dc=myCompany,dc=com");
DirectorySearcher dirSearcher = new DirectorySearcher( dirEntry );
dirSearcher.Filter = "(&(SN="+ LastnameTxt.Text + "*)(givenName="+
FirstnameTxt.Text +"*)(l="+ LocationTxt.Text +"*))";
System.DirectoryServices.PropertyCollection objectPropperties;
foreach (SearchResult resultEntry in dirSearcher.FindAll())
{
//display results
}

Nov 19 '05 #3
Hi Patrick:

Because the Active Directory is setup on a server other than the IIS server,
try explicitly specifying the former when constructing the DirectoryEntry,
e.g.
DirectoryEntry("LDAP://mydomain.ca/dc=myDept,dc=myCompany,dc=com");

(I know this works because I ran into the same problem last week and I
solved it this way)
--
HTH,
Phillip Williams
http://www.societopia.net/Samples/
http://www.societopia.net
http://www.webswapp.com
"Patrick" wrote:
I have read some articles which suggest that I need to turn on "Kerberos"
authentication (in order for token to be passed to Active Directory for
authentication).

How could I turn on Kerberos authentication? It is not an option in IIS6 on
Windows server 2003. Note I am using Integrated Windows authentication at
present.

"Patrick" wrote:
I have an ASP.NET page that searches for someone in the corporate Active
Directory.

It had been working fine until recently when I changed from Basic
Authentication on IIS6 back to Integrated Windows authentication. The error
occurs on the FindAll method. The exceptions are as follows. anyway of
getting the code working with Integrated Windows authentication (too annoying
for user to enter user-name/password). Note I do need to use impersonation
(to figure out the username of the logged on user)

Exception:
System.Runtime.InteropServices.COMException (0x80072020): An operations
error occurred
at System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObj ect()
at System.DirectoryServices.DirectorySearcher.FindAll (Boolean
findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindAll ()
at MyCompany.it.myApp.BUMaintenance.FindMgrBtn_Click( Object sender,
EventArgs e)

Web.config:
<authentication mode="Windows" />
<identity impersonate="true" />

Code snippet below:

DirectoryEntry dirEntry = new
DirectoryEntry("LDAP://dc=myDept,dc=myCompany,dc=com");
DirectorySearcher dirSearcher = new DirectorySearcher( dirEntry );
dirSearcher.Filter = "(&(SN="+ LastnameTxt.Text + "*)(givenName="+
FirstnameTxt.Text +"*)(l="+ LocationTxt.Text +"*))";
System.DirectoryServices.PropertyCollection objectPropperties;
foreach (SearchResult resultEntry in dirSearcher.FindAll())
{
//display results
}

Nov 19 '05 #4
Hi Patrick,

For the problem you encountered, seems somewhat related to the security
context of the asp.net application. As you mentioned that the AD query code
works well when you're using basic authentication but failed when change to
Integrated windows, because when using basic authentication ,the client
user provide full credential so that the serverside logon session has the
network credential(which means it can be forwarded to remote machine for
authentication), however, under integrated windows, the clientside didn't
provide full credential, so the serverside logon session can't be forwarded
to remote machine for authentication. So the problerm you met is possibly
caused by this. Also, in asp.net we can use web.config 's <identity>
element or programmatically to impersonatea fixed account, since in such
means , we provide clear text username/password, the established security
session can be forwarded to remote machine for authentication, here is the
kb article discussing on this:

#How to implement impersonation in an ASP.NET application
http://support.microsoft.com/?id=306158

In addition, you can have a try on Phillip's suggestion.

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| Thread-Topic: "Sudden" Active Directory error on ASP.NET
| thread-index: AcWyQPxwckuHz8KxSL6p/atjSnYCEw==
| X-WBNR-Posting-Host: 198.240.128.75
| From: "=?Utf-8?B?UGF0cmljaw==?=" <qu*******@newsgroup.nospam>
| References: <42**********************************@microsoft.co m>
<4C**********************************@microsoft.co m>
| Subject: RE: "Sudden" Active Directory error on ASP.NET
| Date: Mon, 5 Sep 2005 10:41:03 -0700
| Lines: 58
| Message-ID: <E6**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups:
microsoft.public.adsi.general,microsoft.public.dot net.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:122483
microsoft.public.adsi.general:8890
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Alternatively, is it at all possible to use another (hard-wired) user's
| credentials to authenticate into Active Directory. When I say,
hard-wired
| user, I mean a fixed user that is different from the logged on user
(note, I
| need to use impersonation to figure out from Environment.Username the
| username of the logged on user).
|
| "Patrick" wrote:
|
| > I have read some articles which suggest that I need to turn on
"Kerberos"
| > authentication (in order for token to be passed to Active Directory for
| > authentication).
| >
| > How could I turn on Kerberos authentication? It is not an option in
IIS6 on
| > Windows server 2003. Note I am using Integrated Windows authentication
at
| > present.
| >
| >
| >
| > "Patrick" wrote:
| >
| > > I have an ASP.NET page that searches for someone in the corporate
Active
| > > Directory.
| > >
| > > It had been working fine until recently when I changed from Basic
| > > Authentication on IIS6 back to Integrated Windows authentication.
The error
| > > occurs on the FindAll method. The exceptions are as follows. anyway
of
| > > getting the code working with Integrated Windows authentication (too
annoying
| > > for user to enter user-name/password). Note I do need to use
impersonation
| > > (to figure out the username of the logged on user)
| > >
| > > Exception:
| > > System.Runtime.InteropServices.COMException (0x80072020): An
operations
| > > error occurred
| > > at System.DirectoryServices.DirectoryEntry.Bind(Boole an
throwIfFail)
| > > at System.DirectoryServices.DirectoryEntry.Bind()
| > > at System.DirectoryServices.DirectoryEntry.get_AdsObj ect()
| > > at System.DirectoryServices.DirectorySearcher.FindAll (Boolean
| > > findMoreThanOne)
| > > at System.DirectoryServices.DirectorySearcher.FindAll ()
| > > at MyCompany.it.myApp.BUMaintenance.FindMgrBtn_Click( Object
sender,
| > > EventArgs e)
| > >
| > > Web.config:
| > > <authentication mode="Windows" />
| > > <identity impersonate="true" />
| > >
| > > Code snippet below:
| > >
| > > DirectoryEntry dirEntry = new
| > > DirectoryEntry("LDAP://dc=myDept,dc=myCompany,dc=com");
| > > DirectorySearcher dirSearcher = new DirectorySearcher( dirEntry
);
| > > dirSearcher.Filter = "(&(SN="+ LastnameTxt.Text +
"*)(givenName="+
| > > FirstnameTxt.Text +"*)(l="+ LocationTxt.Text +"*))";
| > > System.DirectoryServices.PropertyCollection objectPropperties;
| > > foreach (SearchResult resultEntry in dirSearcher.FindAll())
| > > {
| > > //display results
| > > }
|

Nov 19 '05 #5
Whilst this new LDAP string works on my developer workstation, porting to the
development IIS6.0 web server, dirSearcher.FindAll().Count returns 0 (when
matches are expected), presumably because no credentials were passed from IIS
to the Active Directory?

"Phillip Williams" wrote:
Hi Patrick:

Because the Active Directory is setup on a server other than the IIS server,
try explicitly specifying the former when constructing the DirectoryEntry,
e.g.
DirectoryEntry("LDAP://mydomain.ca/dc=myDept,dc=myCompany,dc=com");

(I know this works because I ran into the same problem last week and I
solved it this way)
--
HTH,
Phillip Williams
http://www.societopia.net/Samples/
http://www.societopia.net
http://www.webswapp.com
"Patrick" wrote:
I have read some articles which suggest that I need to turn on "Kerberos"
authentication (in order for token to be passed to Active Directory for
authentication).

How could I turn on Kerberos authentication? It is not an option in IIS6 on
Windows server 2003. Note I am using Integrated Windows authentication at
present.

"Patrick" wrote:
I have an ASP.NET page that searches for someone in the corporate Active
Directory.

It had been working fine until recently when I changed from Basic
Authentication on IIS6 back to Integrated Windows authentication. The error
occurs on the FindAll method. The exceptions are as follows. anyway of
getting the code working with Integrated Windows authentication (too annoying
for user to enter user-name/password). Note I do need to use impersonation
(to figure out the username of the logged on user)

Exception:
System.Runtime.InteropServices.COMException (0x80072020): An operations
error occurred
at System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind()
at System.DirectoryServices.DirectoryEntry.get_AdsObj ect()
at System.DirectoryServices.DirectorySearcher.FindAll (Boolean
findMoreThanOne)
at System.DirectoryServices.DirectorySearcher.FindAll ()
at MyCompany.it.myApp.BUMaintenance.FindMgrBtn_Click( Object sender,
EventArgs e)

Web.config:
<authentication mode="Windows" />
<identity impersonate="true" />

Code snippet below:

DirectoryEntry dirEntry = new
DirectoryEntry("LDAP://dc=myDept,dc=myCompany,dc=com");
DirectorySearcher dirSearcher = new DirectorySearcher( dirEntry );
dirSearcher.Filter = "(&(SN="+ LastnameTxt.Text + "*)(givenName="+
FirstnameTxt.Text +"*)(l="+ LocationTxt.Text +"*))";
System.DirectoryServices.PropertyCollection objectPropperties;
foreach (SearchResult resultEntry in dirSearcher.FindAll())
{
//display results
}

Nov 19 '05 #6
On Mon, 5 Sep 2005 10:36:03 -0700, "Patrick" <qu*******@newsgroup.nospam> wrote:

¤ I have read some articles which suggest that I need to turn on "Kerberos"
¤ authentication (in order for token to be passed to Active Directory for
¤ authentication).
¤
¤ How could I turn on Kerberos authentication? It is not an option in IIS6 on
¤ Windows server 2003. Note I am using Integrated Windows authentication at
¤ present.

http://www.microsoft.com/windowsserv...s/default.mspx
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 19 '05 #7
Hi Patrick,

I think though that getting a dirSearcher.FindAll().Count==0 is not a
security access issue. If the responses of Steven and Paul have not helped
you yet to find a solution, you might try a few more tests:

1- log on to the IIS machine and run the application from there,

2- add a Trace.WriteLine statement that displays the
Context.User.Identity.Name to verify that impersonation works.

3- try without a filter condition at all; if you get any result then the
problem is not security related rather it might be the way you specified the
filter condition that caused dirSearcher.FindAll().Count to return 0.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Patrick" wrote:
Whilst this new LDAP string works on my developer workstation, porting to the
development IIS6.0 web server, dirSearcher.FindAll().Count returns 0 (when
matches are expected), presumably because no credentials were passed from IIS
to the Active Directory?

"Phillip Williams" wrote:
Hi Patrick:

Because the Active Directory is setup on a server other than the IIS server,
try explicitly specifying the former when constructing the DirectoryEntry,
e.g.
DirectoryEntry("LDAP://mydomain.ca/dc=myDept,dc=myCompany,dc=com");

(I know this works because I ran into the same problem last week and I
solved it this way)
--
HTH,
Phillip Williams
http://www.societopia.net/Samples/
http://www.societopia.net
http://www.webswapp.com
"Patrick" wrote:
I have read some articles which suggest that I need to turn on "Kerberos"
authentication (in order for token to be passed to Active Directory for
authentication).

How could I turn on Kerberos authentication? It is not an option in IIS6 on
Windows server 2003. Note I am using Integrated Windows authentication at
present.

"Patrick" wrote:

> I have an ASP.NET page that searches for someone in the corporate Active
> Directory.
>
> It had been working fine until recently when I changed from Basic
> Authentication on IIS6 back to Integrated Windows authentication. The error
> occurs on the FindAll method. The exceptions are as follows. anyway of
> getting the code working with Integrated Windows authentication (too annoying
> for user to enter user-name/password). Note I do need to use impersonation
> (to figure out the username of the logged on user)
>
> Exception:
> System.Runtime.InteropServices.COMException (0x80072020): An operations
> error occurred
> at System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail)
> at System.DirectoryServices.DirectoryEntry.Bind()
> at System.DirectoryServices.DirectoryEntry.get_AdsObj ect()
> at System.DirectoryServices.DirectorySearcher.FindAll (Boolean
> findMoreThanOne)
> at System.DirectoryServices.DirectorySearcher.FindAll ()
> at MyCompany.it.myApp.BUMaintenance.FindMgrBtn_Click( Object sender,
> EventArgs e)
>
> Web.config:
> <authentication mode="Windows" />
> <identity impersonate="true" />
>
> Code snippet below:
>
> DirectoryEntry dirEntry = new
> DirectoryEntry("LDAP://dc=myDept,dc=myCompany,dc=com");
> DirectorySearcher dirSearcher = new DirectorySearcher( dirEntry );
> dirSearcher.Filter = "(&(SN="+ LastnameTxt.Text + "*)(givenName="+
> FirstnameTxt.Text +"*)(l="+ LocationTxt.Text +"*))";
> System.DirectoryServices.PropertyCollection objectPropperties;
> foreach (SearchResult resultEntry in dirSearcher.FindAll())
> {
> //display results
> }

Nov 19 '05 #8
Actually I have a correction to what I wrote below. It was not the NTLM
authenticated userID that I used in creating the DirectoryEntry. Upon
careful examination of the code that I left on the IIS server (as opposed to
the version I have on my development desktop) I found that I actually left a
hard-coded userID and password in the DirectoryEntry constructor. So you
were right. It works on the development desktop but not on the IIS server;
the latter required supplying the userID and password.

This is my working solution:
Dim entry As New DirectoryServices.DirectoryEntry(AppSettings("LDAP _PATH"),
strUserID, strPassword)

Sorry if I have caused any confusion.

"Phillip Williams" wrote:
Hi Patrick,

I think though that getting a dirSearcher.FindAll().Count==0 is not a
security access issue. If the responses of Steven and Paul have not helped
you yet to find a solution, you might try a few more tests:

1- log on to the IIS machine and run the application from there,

2- add a Trace.WriteLine statement that displays the
Context.User.Identity.Name to verify that impersonation works.

3- try without a filter condition at all; if you get any result then the
problem is not security related rather it might be the way you specified the
filter condition that caused dirSearcher.FindAll().Count to return 0.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Patrick" wrote:
Whilst this new LDAP string works on my developer workstation, porting to the
development IIS6.0 web server, dirSearcher.FindAll().Count returns 0 (when
matches are expected), presumably because no credentials were passed from IIS
to the Active Directory?

"Phillip Williams" wrote:
Hi Patrick:

Because the Active Directory is setup on a server other than the IIS server,
try explicitly specifying the former when constructing the DirectoryEntry,
e.g.
DirectoryEntry("LDAP://mydomain.ca/dc=myDept,dc=myCompany,dc=com");

(I know this works because I ran into the same problem last week and I
solved it this way)
--
HTH,
Phillip Williams
http://www.societopia.net/Samples/
http://www.societopia.net
http://www.webswapp.com
"Patrick" wrote:

> I have read some articles which suggest that I need to turn on "Kerberos"
> authentication (in order for token to be passed to Active Directory for
> authentication).
>
> How could I turn on Kerberos authentication? It is not an option in IIS6 on
> Windows server 2003. Note I am using Integrated Windows authentication at
> present.
>
>
>
> "Patrick" wrote:
>
> > I have an ASP.NET page that searches for someone in the corporate Active
> > Directory.
> >
> > It had been working fine until recently when I changed from Basic
> > Authentication on IIS6 back to Integrated Windows authentication. The error
> > occurs on the FindAll method. The exceptions are as follows. anyway of
> > getting the code working with Integrated Windows authentication (too annoying
> > for user to enter user-name/password). Note I do need to use impersonation
> > (to figure out the username of the logged on user)
> >
> > Exception:
> > System.Runtime.InteropServices.COMException (0x80072020): An operations
> > error occurred
> > at System.DirectoryServices.DirectoryEntry.Bind(Boole an throwIfFail)
> > at System.DirectoryServices.DirectoryEntry.Bind()
> > at System.DirectoryServices.DirectoryEntry.get_AdsObj ect()
> > at System.DirectoryServices.DirectorySearcher.FindAll (Boolean
> > findMoreThanOne)
> > at System.DirectoryServices.DirectorySearcher.FindAll ()
> > at MyCompany.it.myApp.BUMaintenance.FindMgrBtn_Click( Object sender,
> > EventArgs e)
> >
> > Web.config:
> > <authentication mode="Windows" />
> > <identity impersonate="true" />
> >
> > Code snippet below:
> >
> > DirectoryEntry dirEntry = new
> > DirectoryEntry("LDAP://dc=myDept,dc=myCompany,dc=com");
> > DirectorySearcher dirSearcher = new DirectorySearcher( dirEntry );
> > dirSearcher.Filter = "(&(SN="+ LastnameTxt.Text + "*)(givenName="+
> > FirstnameTxt.Text +"*)(l="+ LocationTxt.Text +"*))";
> > System.DirectoryServices.PropertyCollection objectPropperties;
> > foreach (SearchResult resultEntry in dirSearcher.FindAll())
> > {
> > //display results
> > }

Nov 19 '05 #9
Thanks for your detailed followup Phillip,

Hi Patrick,

Have you had a try on the suggestions in my last reply? I'm still thinking
the problem is concerned with your asp.net web application's security
context. And impersonation is a potential cause, if there're any further
finding or anything we can help, please feel free to post here.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: "Sudden" Active Directory error on ASP.NET
| thread-index: AcWzQSB7RPR3OtazRFqlDQHhtLAcGw==
| X-WBNR-Posting-Host: 207.230.226.92
| From: "=?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?="
<Ph**************@webswapp.com>
| References: <42**********************************@microsoft.co m>
<4C**********************************@microsoft.co m>
<F7**********************************@microsoft.co m>
<0F**********************************@microsoft.co m>
<0E**********************************@microsoft.co m>
| Subject: RE: "Sudden" Active Directory error on ASP.NET
| Date: Tue, 6 Sep 2005 17:14:34 -0700
| Lines: 116
| Message-ID: <E8**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups:
microsoft.public.adsi.general,microsoft.public.dot net.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:122743
microsoft.public.adsi.general:8911
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Actually I have a correction to what I wrote below. It was not the NTLM
| authenticated userID that I used in creating the DirectoryEntry. Upon
| careful examination of the code that I left on the IIS server (as opposed
to
| the version I have on my development desktop) I found that I actually
left a
| hard-coded userID and password in the DirectoryEntry constructor. So you
| were right. It works on the development desktop but not on the IIS
server;
| the latter required supplying the userID and password.
|
| This is my working solution:
| Dim entry As New
DirectoryServices.DirectoryEntry(AppSettings("LDAP _PATH"),
| strUserID, strPassword)
|
| Sorry if I have caused any confusion.
|
| "Phillip Williams" wrote:
|
| > Hi Patrick,
| >
| > I think though that getting a dirSearcher.FindAll().Count==0 is not a
| > security access issue. If the responses of Steven and Paul have not
helped
| > you yet to find a solution, you might try a few more tests:
| >
| > 1- log on to the IIS machine and run the application from there,
| >
| > 2- add a Trace.WriteLine statement that displays the
| > Context.User.Identity.Name to verify that impersonation works.
| >
| > 3- try without a filter condition at all; if you get any result then
the
| > problem is not security related rather it might be the way you
specified the
| > filter condition that caused dirSearcher.FindAll().Count to return 0.
| >
| > --
| > HTH,
| > Phillip Williams
| > http://www.societopia.net
| > http://www.webswapp.com
| >
| >
| > "Patrick" wrote:
| >
| > > Whilst this new LDAP string works on my developer workstation,
porting to the
| > > development IIS6.0 web server, dirSearcher.FindAll().Count returns 0
(when
| > > matches are expected), presumably because no credentials were passed
from IIS
| > > to the Active Directory?
| > >
| > > "Phillip Williams" wrote:
| > >
| > > > Hi Patrick:
| > > >
| > > > Because the Active Directory is setup on a server other than the
IIS server,
| > > > try explicitly specifying the former when constructing the
DirectoryEntry,
| > > > e.g.
| > > > DirectoryEntry("LDAP://mydomain.ca/dc=myDept,dc=myCompany,dc=com");
| > > >
| > > > (I know this works because I ran into the same problem last week
and I
| > > > solved it this way)
| > > > --
| > > > HTH,
| > > > Phillip Williams
| > > > http://www.societopia.net/Samples/
| > > > http://www.societopia.net
| > > > http://www.webswapp.com
| > > >
| > > >
| > > > "Patrick" wrote:
| > > >
| > > > > I have read some articles which suggest that I need to turn on
"Kerberos"
| > > > > authentication (in order for token to be passed to Active
Directory for
| > > > > authentication).
| > > > >
| > > > > How could I turn on Kerberos authentication? It is not an option
in IIS6 on
| > > > > Windows server 2003. Note I am using Integrated Windows
authentication at
| > > > > present.
| > > > >
| > > > >
| > > > >
| > > > > "Patrick" wrote:
| > > > >
| > > > > > I have an ASP.NET page that searches for someone in the
corporate Active
| > > > > > Directory.
| > > > > >
| > > > > > It had been working fine until recently when I changed from
Basic
| > > > > > Authentication on IIS6 back to Integrated Windows
authentication. The error
| > > > > > occurs on the FindAll method. The exceptions are as follows.
anyway of
| > > > > > getting the code working with Integrated Windows authentication
(too annoying
| > > > > > for user to enter user-name/password). Note I do need to use
impersonation
| > > > > > (to figure out the username of the logged on user)
| > > > > >
| > > > > > Exception:
| > > > > > System.Runtime.InteropServices.COMException (0x80072020): An
operations
| > > > > > error occurred
| > > > > > at System.DirectoryServices.DirectoryEntry.Bind(Boole an
throwIfFail)
| > > > > > at System.DirectoryServices.DirectoryEntry.Bind()
| > > > > > at System.DirectoryServices.DirectoryEntry.get_AdsObj ect()
| > > > > > at
System.DirectoryServices.DirectorySearcher.FindAll (Boolean
| > > > > > findMoreThanOne)
| > > > > > at System.DirectoryServices.DirectorySearcher.FindAll ()
| > > > > > at MyCompany.it.myApp.BUMaintenance.FindMgrBtn_Click( Object
sender,
| > > > > > EventArgs e)
| > > > > >
| > > > > > Web.config:
| > > > > > <authentication mode="Windows" />
| > > > > > <identity impersonate="true" />
| > > > > >
| > > > > > Code snippet below:
| > > > > >
| > > > > > DirectoryEntry dirEntry = new
| > > > > > DirectoryEntry("LDAP://dc=myDept,dc=myCompany,dc=com");
| > > > > > DirectorySearcher dirSearcher = new DirectorySearcher(
dirEntry );
| > > > > > dirSearcher.Filter = "(&(SN="+ LastnameTxt.Text +
"*)(givenName="+
| > > > > > FirstnameTxt.Text +"*)(l="+ LocationTxt.Text +"*))";
| > > > > > System.DirectoryServices.PropertyCollection
objectPropperties;
| > > > > > foreach (SearchResult resultEntry in dirSearcher.FindAll())
| > > > > > {
| > > > > > //display results
| > > > > > }
|

Nov 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Rene Pijlman | last post by:
Section 6.5 "What is delegation?" of the FAQ says: "Python programmers can easily implement delegation. For example, the following class implements a class that behaves like a file but converts...
1
by: Chumley the Walrus | last post by:
I am now all of a sudden getting an error in this sql connection string, saying that the Provider keyword is invalid: <add key="MM_CONNECTION_STRING_isox"...
0
by: XmlAdoNewbie | last post by:
Hello All, I have come across something that seems a big buggy to me. I have an app with about 15 comboboxes on it. The comboboxes are loaded with name/value pairs at run time. Sometimes i will...
1
by: Anders K. Jacobsen [DK] | last post by:
Hi Im developing an ASP.NET CRUD application where i need to do some authorization checks on surden actions. Eg. some account have access to delete in a sudden datagrid and some have not. So I...
3
by: Chuck Cobb | last post by:
I'm doing a CSharp project in VS2005 and I'm getting some strange warning messages. The problem is that the warning messages don't link to anything in my code so they are very difficult to track...
5
by: PW | last post by:
Hi, All of a sudden, some clients of our Access 2003 software are getting Asian lettering in some text boxes, combo boxes, etc.... We have done nothing to it. Any ideas?
94
by: Samuel R. Neff | last post by:
When is it appropriate to use "volatile" keyword? The docs simply state: " The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock...
2
by: johnwaddy | last post by:
I'm clueless to the problem, I have a couple of account with 300+ records and all of a sudden when you recalc it reaches record 256 and pops up this "Overflow" error. I do not have any issues with...
2
by: CRS1 | last post by:
Hello, I am using Visual Studio 2008 to build and deploy a C# ClickOnce Application for .NET 3.5. Yesterday, I had to find out that all a sudden, my ClickOnce deployment breaks. The users now get...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.