(&(objectCategory = user)(|(CN =)(sAMAccountName =)))検索フィルターが無効です。
誰かがこのエラーがどのような状況で表示されるか教えてもらえますか?
VisualStudioを介してWebアプリケーションを公開しようとしています。ローカルホストで正常に実行されますが、公開後にこのエラーが発生します。
public static string[] ldapUserQuery(string userName, string[] desiredProps)
{
// Establishes path for query. In this case sap.corp
string queryPath = "LDAP://DC=SAP,DC=CORP";
// Used to establish desiredProps from within the function, but now it can be passed in.
// This was kept in here as an example of what the desiredProps should look like when
// passing it in.
//
// Desired pros are the LDAP attributes to be returned.
/*
string[] desiredProps = new string[]
{
//"givenName", // first name
//"sn", // last name
//"mail" // email
};
*/
// establishes the proper length of the array to be returned.
string[] returnVal = new string[desiredProps.Length];
// Creates objects for performing the Query.
DirectoryEntry dirEntry = new DirectoryEntry();
DirectorySearcher dirSearcher = new DirectorySearcher();
SearchResult result;
// dirEntry is used for establishing the connection for the query
dirEntry.Path = queryPath;
dirEntry.AuthenticationType = AuthenticationTypes.Secure;
// dirSearcher is the query itself.
dirSearcher.SearchRoot = dirEntry;
dirSearcher.Filter = string.Format("(&(objectCategory=user)(|(CN={0})(sAMAccountName={0})))", userName);
// executes the query.
result = dirSearcher.FindOne();
// handle the result of the query.
if (result != null)
{
// if the query was successful, then dig through the returned information
// and set found objects that match the desiredProps to the returnVal object.
for (int i = 0; i < desiredProps.Length; i++)
{
// if the desiredProps has a bad attribute name, just give it the placeholder
// and move along.
if (result.Properties[desiredProps[i]] != null)
{
returnVal[i] = result.GetDirectoryEntry().Properties[desiredProps[i]].Value.ToString();
}
//else
//{
// returnVal[i] = GlobalVars.placeHolder;
//}
}
}