R
Roland Wolters
Hi,
Using wse2.0 a user logs on to my application. The webservice runs
within the domain, the user does not (not allways). So I use the
websrvice to read from the central database and to veryfy the
username/pasword. Doing that I want to return the full name for the
user.
To do this I wrote (well, partially find it on the internet ;-)) this
method:
public static String GetLDAPName(String userAccount)
{
DirectoryEntry entry = new DirectoryEntry("LDAP://xxx");
String account =userAccount.Replace(@"@xxx", "");
try
{
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + account + ")";
search.PropertiesToLoad.Add("displayName");
SearchResult result = search.FindOne();
if( result != null )
{
return result.Properties["displayname"][0].ToString();
}
else
{
return "Unknown User";
}
}
catch( Exception ex )
{
return ex.Message;
}
}
If I try it, it allways returns "an operations error occured". That's
good info isn't it!! NOT!
To find out if the method is wrong I also put it in a windows app and
testied it on another machine (no visual studio installed, just x-copy
deployed) in the same domein as the webserver. Without having to set any
trusts it ran fine!
What's wrong here? Is this a matter of setting permissions on the
webserver? And what would that be?
MAzzel,
Roland
Using wse2.0 a user logs on to my application. The webservice runs
within the domain, the user does not (not allways). So I use the
websrvice to read from the central database and to veryfy the
username/pasword. Doing that I want to return the full name for the
user.
To do this I wrote (well, partially find it on the internet ;-)) this
method:
public static String GetLDAPName(String userAccount)
{
DirectoryEntry entry = new DirectoryEntry("LDAP://xxx");
String account =userAccount.Replace(@"@xxx", "");
try
{
DirectorySearcher search = new DirectorySearcher(entry);
search.Filter = "(SAMAccountName=" + account + ")";
search.PropertiesToLoad.Add("displayName");
SearchResult result = search.FindOne();
if( result != null )
{
return result.Properties["displayname"][0].ToString();
}
else
{
return "Unknown User";
}
}
catch( Exception ex )
{
return ex.Message;
}
}
If I try it, it allways returns "an operations error occured". That's
good info isn't it!! NOT!
To find out if the method is wrong I also put it in a windows app and
testied it on another machine (no visual studio installed, just x-copy
deployed) in the same domein as the webserver. Without having to set any
trusts it ran fine!
What's wrong here? Is this a matter of setting permissions on the
webserver? And what would that be?
MAzzel,
Roland