2013-02-28 129 views
0

我有一个asp.net网站,Active Directory中搜索使用此代码的用户详细信息:搜索Active Directory从ASP.NET

该网站是Windows Server 2003和IIS5上伟大的工作。 最近我的网站移动到新的Windows Server 2008 IIS7.5 我添加应用程序IIS和瞬移的网站,我得到这个错误:

The (&(objectCategory=person)(sAMAccountName=)) search filter is invalid. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: The (&(objectCategory=person)(sAMAccountName=)) search filter is invalid.

当我运行通过Visual Studio我的网站,它的工作原理。该问题仅来自IIS。

有人可以帮助我吗?

回答

1

您的“用户名”变量为空,导致您的过滤器以等号(实际上是无效)终止。不知道更多关于您的设置,很难说。但听起来很明显,您没有在新服务器上为网站设置正确的身份验证 - 导致您必须填写用户名的任何例行程序才能取回任何内容。

1

错误很明显,因为“username”是一个空字符串。这很可能是因为您的用户正在匿名登录您的网站。请确保在IIS中禁用匿名访问。

但是,如果您可以显示调用GetUserProfileFromAD的代码将会很有帮助。

0

对我而言,似乎并未填充变量用户名,如果您声称已将其移至IIS,请尝试再次检查安全选项,但很可能尚未配置Windows身份验证。