Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<pre>"LDAP://xxxxxxx.co.uk" </pre>

I am using this ldap function in my project and it is working fine in my local machine, but when i execute in IIS it shows me an error
DirectoryEntry dsresult = sresult.GetDirectoryEntry();
<pre>Object reference not set to an instance of an object</pre>

I have changed the string like this and i tried still it shows me error.
"LDAP://dc=xxxxxx,dc=co,dc=uk"


Please help me what changes to be done in LDAP fuction to make the project run successfully in IIS
Posted
Comments
thatraja 29-Oct-13 8:10am    
what's the error?
sathish kumar 29-Oct-13 8:52am    
Object reference not set to an instance of an object in the line DirectoryEntry dsresult = sresult.GetDirectoryEntry();
ZurdoDev 29-Oct-13 8:40am    
It's likely a permissions issue, but the error doesn't seem like it would be. Or, that error is not happening on that line of code.
sathish kumar 29-Oct-13 8:53am    
if I comment all the ldap lines
string connection = ConfigurationManager.ConnectionStrings["ADConnection"].ToString();
DirectorySearcher dssearch = new DirectorySearcher(connection);
string SAM = System.Web.HttpContext.Current.Request.LogonUserIdentity.Name.ToString();
dssearch.Filter = "(sAMAccountName=" + SAM.Substring(10, SAM.Length - 10) + ")";
SearchResult sresult = dssearch.FindOne();
DirectoryEntry dsresult = sresult.GetDirectoryEntry();

it's working fine, so i believe the error may be in this line only... if in case permission issue how to solve it?
ZurdoDev 29-Oct-13 9:03am    
Well, figure out the exact line of code causing the error first.

1 solution

Based on the little bit of information you've provided, it's probably because the account that your ASP.NET code is running under does not have Read permissions to the directory you're querying.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900