troubleshooting Question

DirectoryEntry causing error in Sharepoint web part

Avatar of jgags
jgags asked on
Web Development
2 Comments1 Solution719 ViewsLast Modified:
I'm trying to create a sharepoint web part (in vb.net) to access some AD attributes.    My function works fine in a windows app, but I get an "System.Security.SecurityException: Security error."   error when I place it in my sharepoint site.  Here's the description of the error:

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.



The line that it actually errors out on is where I declare an directory entry:  

Dim odomain  As DirectoryEntry = New DirectoryEntry("LDAP://" & sDomain, sUsername, sPassword)


I have the trust leve in my web config file as wss_medium.  
Any help with this issue would be greatly appreciated since I'm really out of troubleshooting options.  
ASKER CERTIFIED SOLUTION
hybridron

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros