Quantcast
Channel: Configuration and Deployment
Viewing all articles
Browse latest Browse all 3561

DirectorySearcher returning different response on Server 2012

$
0
0

I have a routine which checks a persons credentials against a corporate directory.  It's been running fine for years on Server 2003 but as I migrated it to Server 2012 it stopped working.

The routine looks like this (with editing out of private info)

                   

DirectoryEntry entry = newDirectoryEntry(location of directory here);

                    entry.AuthenticationType = AuthenticationTypes.SecureSocketsLayer;

DirectorySearcher searcher = newDirectorySearcher(entry);

                    searcher.Filter ="(alias="+ strUsername + ')';

SearchResult result = searcher.FindOne();

string path = result.Path;

  path = path.Substring(path.LastIndexOf("/")+ 1);

                    gin = result.Properties["employeeType"].Count.ToString();

                    gin = gin + "<br>"+ result.Properties["employeeType"][0].ToString();

if (result.Properties["employeeType"].Count>0)

                    {

                       if("employee"== result.Properties["employeeType"][0].ToString().ToLower())

                        {

                            gin = gin + "<br>"+result.Properties["employeenumber"][0].ToString();

                        }

                    }

All the "gin" coding is there to capture to a tag what the application was seeing (sorry I don't have the experience all of you have in diagnostics :) )

On the 2003 machine the label would be filled as follows:

1

employee

12345

 

on the 2012 machine the esponse comes back

1

System.Byte[]

 

Can someone tell me is there something I should set up different in this application to deploy it on a 2012 machine versus a 2003?

 

Thanks,

Mike


Viewing all articles
Browse latest Browse all 3561