Hi All,
I have a web service method which works fine when called from my local
machine i.e. from localhost but when I publish the web services to a remote
machine it throws an invalid cast soap exception.
That web service method access Active Directory to get the group names for
the given user. Following is the code.
DirectorySearcher dirSearcher = new DirectorySearcher();
dirSearcher.Filter = String.Format("(cn={0})", strCommonName);
dirSearcher.PropertiesToLoad.Add("MemberOf");
SearchResult result = dirSearcher.FindOne();
string group = (string)result.Properties["memberOf"][0]
It's the last line where it throws an exception,
Unable to cast object of type 'System.Byte[]' to type 'System.String'.
And this happens only when I try to use the web service method from the
remote server. It works fine when used from my local machine.
Using VS .NET 2005 to develop the web services.
The remote server is a 64 bit Windows XP machine running VS.NET 2005 runtime.
Thanks for any help!
Abhi