473,506 Members | 16,201 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

LDAP connection & query works on XP, but not on 2003

Hello.

I have an asp.net application that resides on a non-DC / BDC Sharepoint
Server (although it is logged into the domain). The application will perform
lookups based on the current user (integrated auth) to an LDAP server which
requires no login (AuthenticationTypes.None). When I run it, I get the
following ambiguous error:

Security Exception
Description: The application attempted to perform an operation not allowed
by the security policy. To grant this application the required permission
please contact your system administrator or change the application's trust
level in the configuration file.

Exception Details: System.Security.SecurityException: Security error.

But - the ldap query works flawlessly on my XP development machine (where I
am logged into the domain also).

What I've done:
Excluded the virt directory from SPS (so IIS will handle it)
in web.config:
<authentication mode="Windows" />
<identity impersonate="true"/>
in IIS - tried Basic (tied to my domain name and pwd) only and then
Integrated auth only
added a reference in dotnet to the System.DirectoryServices dll
looked in event viewer - no errors
created app pool specifically for the site. tried all of the identity
options (inc domain\username & pwd)

I have a very strong feeling that the security error is not linked to
the actual LDAP query, but to the loading of the directoryservices dll (or
some other windows 2003 config setting), when it is called. What leads me to
that conclusion is when I am debugging, I will not get that error when i rem
out the line --> dirEntry = new
DirectoryEntry("LDAP://server:389/ou=People,o=site.org"); <---. When that
line is unrem'd, the debugger never begins to debug - I get the error first.

using System.DirectoryServices;

........

DirectoryEntry dirEntry;
dirEntry = new DirectoryEntry(LDAP://server:389/ou=People,o=site.org);
dirEntry.AuthenticationType = AuthenticationTypes.None;
//perform lookup

Thanks much in advance for any ideas. Again, my code is good - it works on
my other box. It just doesn't run on the server.
Jul 21 '05 #1
3 4965
This has nothing to do with windows security, it's a Code Access Security
issue. Do you run this code from a networkshare perhaps?
If you do, you must change the CAS settings.

Willy.

"jeremy" <JJ@mailinator.com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
Hello.

I have an asp.net application that resides on a non-DC / BDC Sharepoint
Server (although it is logged into the domain). The application will
perform
lookups based on the current user (integrated auth) to an LDAP server
which
requires no login (AuthenticationTypes.None). When I run it, I get the
following ambiguous error:

Security Exception
Description: The application attempted to perform an operation not allowed
by the security policy. To grant this application the required permission
please contact your system administrator or change the application's trust
level in the configuration file.

Exception Details: System.Security.SecurityException: Security error.

But - the ldap query works flawlessly on my XP development machine (where
I
am logged into the domain also).

What I've done:
Excluded the virt directory from SPS (so IIS will handle it)
in web.config:
<authentication mode="Windows" />
<identity impersonate="true"/>
in IIS - tried Basic (tied to my domain name and pwd) only and then
Integrated auth only
added a reference in dotnet to the System.DirectoryServices dll
looked in event viewer - no errors
created app pool specifically for the site. tried all of the identity
options (inc domain\username & pwd)

I have a very strong feeling that the security error is not linked to
the actual LDAP query, but to the loading of the directoryservices dll (or
some other windows 2003 config setting), when it is called. What leads me
to
that conclusion is when I am debugging, I will not get that error when i
rem
out the line --> dirEntry = new
DirectoryEntry("LDAP://server:389/ou=People,o=site.org"); <---. When that
line is unrem'd, the debugger never begins to debug - I get the error
first.

using System.DirectoryServices;

.......

DirectoryEntry dirEntry;
dirEntry = new DirectoryEntry(LDAP://server:389/ou=People,o=site.org);
dirEntry.AuthenticationType = AuthenticationTypes.None;
//perform lookup

Thanks much in advance for any ideas. Again, my code is good - it works on
my other box. It just doesn't run on the server.

Jul 21 '05 #2
Thanks for your help. I wasn't running from a network share, but based on
your reply, was able to come to a solution.

After reading this document -->
http://msdn.microsoft.com/library/de...l/secmod81.asp
and this document -->
http://msdn.microsoft.com/library/de...l/secmod82.asp
I ran some tests and came to the realization that I probably have to load
the dll into the GAC. I tinkered with the machine.config and added my own
custom security configuration files, but to no avail. There must be
something about the system.directoryservices dll that requires full access.
I wasn't able to figure out how to do that, so I tried the last resort -
gac. strong named it, and added the dll to the gac using the .NET
Configuration 1.1 snap-in. Restarted IIS and it worked. Will likely use this
solution when the project goes into production next week.

I hope this helps someone else who is running sharepoint (@ medium security)
and ASP.NET

Thanks for your help Willy. If you do have any other suggestions as to why /
how to add the System.DirectoryServices to some customized .config files, I
am all ears.
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:#$**************@tk2msftngp13.phx.gbl...
This has nothing to do with windows security, it's a Code Access Security
issue. Do you run this code from a networkshare perhaps?
If you do, you must change the CAS settings.

Willy.

"jeremy" <JJ@mailinator.com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
Hello.

I have an asp.net application that resides on a non-DC / BDC Sharepoint
Server (although it is logged into the domain). The application will
perform
lookups based on the current user (integrated auth) to an LDAP server
which
requires no login (AuthenticationTypes.None). When I run it, I get the
following ambiguous error:

Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Security error.

But - the ldap query works flawlessly on my XP development machine (where I
am logged into the domain also).

What I've done:
Excluded the virt directory from SPS (so IIS will handle it)
in web.config:
<authentication mode="Windows" />
<identity impersonate="true"/>
in IIS - tried Basic (tied to my domain name and pwd) only and then
Integrated auth only
added a reference in dotnet to the System.DirectoryServices dll
looked in event viewer - no errors
created app pool specifically for the site. tried all of the identity
options (inc domain\username & pwd)

I have a very strong feeling that the security error is not linked to
the actual LDAP query, but to the loading of the directoryservices dll (or some other windows 2003 config setting), when it is called. What leads me to
that conclusion is when I am debugging, I will not get that error when i
rem
out the line --> dirEntry = new
DirectoryEntry("LDAP://server:389/ou=People,o=site.org"); <---. When that line is unrem'd, the debugger never begins to debug - I get the error
first.

using System.DirectoryServices;

.......

DirectoryEntry dirEntry;
dirEntry = new DirectoryEntry(LDAP://server:389/ou=People,o=site.org);
dirEntry.AuthenticationType = AuthenticationTypes.None;
//perform lookup

Thanks much in advance for any ideas. Again, my code is good - it works on my other box. It just doesn't run on the server.


Jul 21 '05 #3
>>There must be something about the system.directoryservices dll that requires full access.

To a certain degree - yes. You might want to post your question to the

microsoft.public.adsi.general

newsgroup - there are a number of very highly skilled AD / ASP.NET
programmers hanging out there who definitely knows this in depth. (I'm
not a ASP.NET guy, so I can't really help you myself).

Marc

================================================== ==============
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
Jul 21 '05 #4

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

Similar topics

1
1371
by: sergio | last post by:
Hello I try to set my LDAP to accept query comming from a .asp aplication On windows 2000 , all works fine. The user logging in to my asp aplication is aut. by the AD LDAP Trying the same...
1
5169
by: Enigma Webmaster | last post by:
We've had an ASP running for about 9 months which returns a full listing of network users (taken directly from AD), and it has now stopped working with the following; Provider Error '80004005'....
0
1626
by: Tim | last post by:
Hello, I'm trying very (too) hard to log uses LDAP (via ADSI) to autheniticate users in an A2k2 application. We have AD and I have that working slick. We are in a tranistion from NDS to AD and...
0
1511
by: Tim | last post by:
Hello, I'm trying very (too) hard to log uses LDAP (via ADSI) to autheniticate users in an A2k2 application. We have AD and I have that working slick. We are in a tranistion from NDS to AD and...
5
2323
by: Bryan | last post by:
Hello, I have a asp.net app working with directory services on my Windows XP development machine. However when I moved the application over to our production server (Win 2000 Server) it no longer...
3
304
by: jeremy | last post by:
Hello. I have an asp.net application that resides on a non-DC / BDC Sharepoint Server (although it is logged into the domain). The application will perform lookups based on the current user...
2
5637
by: Anbu | last post by:
Sorry for cross posting the query. But I need a resolution as early as possible. I have developed an application to authenticate the user based on LDAP Search and authentication. The Windows...
2
2651
by: HamishC | last post by:
Hi all, I have been knocking my head against this one for a few days -- haven't been able to find a solution to this anywhere so hopefully someone can help. Situation: A really simple LDAP that...
7
7018
by: MrHelpMe | last post by:
Sorry everyone, NOTE: I have posted this question to another site but unfortunately, am not getting the answers I need only because those helping haven't worked with ASP. I am in desperate...
0
7105
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
5617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3178
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1534
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
410
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.