G
greenzrx
I have the following snippet of code which works both as a standalone
application and as when incorporated to a windows service.
There seems to be a slight difference between the service and the
standalone app however.
We have a legacy VB app which uses ADSI to apply file permissions. I
have no access to the legacy app, and development has stopped on it.
Here is the issue:
Groups modified with the service cause the legacy application to
fail. Paste the same exact code into a standalone windows app, and
the group is usable.
The user running the windows service and the windows application are
the same (domain) user.
Any ideas?
public void AddToGroup(string userDn, string groupDn)
{
try
{
DirectoryEntry dirEntry = new DirectoryEntry("LDAP://"
+ groupDn);
dirEntry.Properties["member"].Add(userDn);
dirEntry.CommitChanges();
dirEntry.Close();
}
catch
(System.DirectoryServices.DirectoryServicesCOMException E)
{
System.Diagnostics.Debug.WriteLine(E.Message.ToString());
}
}
application and as when incorporated to a windows service.
There seems to be a slight difference between the service and the
standalone app however.
We have a legacy VB app which uses ADSI to apply file permissions. I
have no access to the legacy app, and development has stopped on it.
Here is the issue:
Groups modified with the service cause the legacy application to
fail. Paste the same exact code into a standalone windows app, and
the group is usable.
The user running the windows service and the windows application are
the same (domain) user.
Any ideas?
public void AddToGroup(string userDn, string groupDn)
{
try
{
DirectoryEntry dirEntry = new DirectoryEntry("LDAP://"
+ groupDn);
dirEntry.Properties["member"].Add(userDn);
dirEntry.CommitChanges();
dirEntry.Close();
}
catch
(System.DirectoryServices.DirectoryServicesCOMException E)
{
System.Diagnostics.Debug.WriteLine(E.Message.ToString());
}
}