Web应用程序中的AD [英] AD in Web Application
问题描述
全部,
我想通过Web应用程序从我的AD中检索用户。我运行这个脚本
来填充普通应用程序中的组合框并且它可以工作......
但是当我在Web应用程序中使用这个脚本时它会失败
任何想法为什么?
Marc
昏暗条目为新
DirectoryServices.DirectoryEntry(" LDAP:/ / DC = PROD,DC = TELENET,DC = BE")
Dim mySearcher1 As New System.DirectoryServices.DirectorySearcher(entry)
昏暗的结果As System.DirectoryServices.SearchResult
Dim oValue As New ArrayList
Dim mySearcher
对于每个结果在mySearcher.FindAll()
oValue.Add(Microsoft.VisualBasic.Right(result.GetD irectoryEntry()。姓名,
Len (result.GetDirectoryEntry()。姓名) - 3))
下一页
User1.DataSource = oValue
>
User1.Visible = True
" MDS" < ab*@abc.com>在消息中写道
news:eu ************** @ TK2MSFTNGP12.phx.gbl ...全部,
我想通过Web应用程序从AD中检索用户。我运行这个
脚本来填充普通应用程序中的组合框并且它可以工作......
但是当我在Web应用程序中使用这个脚本时它会失败
任何想法为什么?
Marc
Dim entry As New
DirectoryServices.DirectoryEntry(" LDAP:// DC = PROD,DC = TELENET,DC = BE")
Dim mySearcher1 As New System.DirectoryServices.DirectorySearcher(entry)
昏暗的结果As System.DirectoryServices.SearchResult
Dim oValue As New ArrayList
Dim mySearcher
每个结果在mySearcher.FindAll()
应该由MySearcher1吗?
oValue.Add(Microsoft.VisualBasic.Right (result.GetD irectoryEntry()。Name,
Len(result.GetDirectoryEntry()。Name) - 3))
下一页
User1.DataSource = oValue
User1.Visible = True
嗨MDS,
这种错误主要是因为aspnet用户在服务器上(幸运地)没有
权限资源。
但这是一个好处,
Cor
默认情况下您的Web应用程序将在计算机帐户下运行,该计算机帐户
没有网络权限。您可以指定一个用户名和密码
,它有权在您创建条目时访问该LDAP根目录。 (请参阅
重载,以便DirectoryEntry构造函数传递凭据),或者 - 你
可以在您的网络应用中使用模拟。 (仅当人们点击它时才这样做
将来自您当地域名的内部网络。)
传递凭证:
Dim entry As New
DirectoryServices.DirectoryEntry(" LDAP:// DC = PROD,DC = TELENET,DC = BE",
" userLogin" ;,密码)
要启用模拟,请在web.config文件中将其添加到
< system.web>配置部分:
< identity impersonate =" true" />
(模仿键还允许您冒充特定用户
该Web应用程序。有关asp.net的
身份标签或此kb文章的详细信息,请参阅文档
http://support.microsoft.com/default.aspx?kbid=306158 )
" CJ Taylor" <无**** @ blowgoats.com>在消息中写道
news:10 ************* @ corp.supernews.com ...
" MDS" < ab*@abc.com>在消息中写道
新闻:eu ************** @ TK2MSFTNGP12.phx.gbl ...全部,
>我想通过Web应用程序从我的AD中检索用户。我运行了这个
脚本来填充普通应用程序中的组合框并且它可以工作......
但是当我在Web应用程序中使用此脚本时它失败了
任何想法为什么?
Marc
Dim entry as New
DirectoryServices.DirectoryEntry(" LDAP:// DC = PROD,DC = TELENET,DC = BE" ;)
Dim mySearcher1 As New System.DirectoryServices.DirectorySearcher(entry)
Dim result As System.DirectoryServices.SearchResult
Dim oValue As New ArrayList
Dim mySearcher
每个结果在mySearcher.FindAll()
这应该是MySearcher1吗?
< blockquote class =post_quotes> oValue.Add(Microsoft.VisualBasic.Right(result.GetD irectoryEntry()。Name,
Len(result.GetDirectoryEntry()。Name) - 3))
下一页
User1.DataSource = oValue
User1.Visible = True
All,
I want to retrieve Users from my AD via a Web appliction. I ran this script
to populate a combobox in a normal app and it works...
But when I use this script in a Web App it fails
Any Idea Why?
Marc
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE")
Dim mySearcher1 As New System.DirectoryServices.DirectorySearcher(entry)
Dim result As System.DirectoryServices.SearchResult
Dim oValue As New ArrayList
Dim mySearcher
For Each result In mySearcher.FindAll()
oValue.Add(Microsoft.VisualBasic.Right(result.GetD irectoryEntry().Name,
Len(result.GetDirectoryEntry().Name) - 3))
Next
User1.DataSource = oValue
User1.Visible = True
"MDS" <ab*@abc.com> wrote in message
news:eu**************@TK2MSFTNGP12.phx.gbl...All,
I want to retrieve Users from my AD via a Web appliction. I ran this script to populate a combobox in a normal app and it works...
But when I use this script in a Web App it fails
Any Idea Why?
Marc
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE")
Dim mySearcher1 As New System.DirectoryServices.DirectorySearcher(entry)
Dim result As System.DirectoryServices.SearchResult
Dim oValue As New ArrayList
Dim mySearcher
For Each result In mySearcher.FindAll()
should this by MySearcher1?
oValue.Add(Microsoft.VisualBasic.Right(result.GetD irectoryEntry().Name,
Len(result.GetDirectoryEntry().Name) - 3))
Next
User1.DataSource = oValue
User1.Visible = True
Hi MDS,
This kind of errors is mostly because the aspnet user has (fortunatly) no
rights on the server resources.
But it is a gues,
Cor
By default your web application will run under the machine account, which
has no network privledges. You could either specify a username and password
that has rights to access that LDAP root when you create "entry" (see the
overloads for the DirectoryEntry constructor to pass credentials), or - you
could use impersonation in your web app. (do this only if people hitting it
will be from an internal network, on your local domain).
To pass in credentials:
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE",
"userLogin", "Password")
To enable impersonation, in your web.config file, add this in the
<system.web> config section:
<identity impersonate="true"/>
(the impersonate key would also allow you to impersonate a specific user for
that web application. See the docs for more information on asp.net''s
identity tag, or this kb article
http://support.microsoft.com/default.aspx?kbid=306158)
"CJ Taylor" <no****@blowgoats.com> wrote in message
news:10*************@corp.supernews.com...
"MDS" <ab*@abc.com> wrote in message
news:eu**************@TK2MSFTNGP12.phx.gbl...All,
I want to retrieve Users from my AD via a Web appliction. I ran this
scriptto populate a combobox in a normal app and it works...
But when I use this script in a Web App it fails
Any Idea Why?
Marc
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://DC=PROD,DC=TELENET,DC=BE")
Dim mySearcher1 As New System.DirectoryServices.DirectorySearcher(entry)
Dim result As System.DirectoryServices.SearchResult
Dim oValue As New ArrayList
Dim mySearcher
For Each result In mySearcher.FindAll()
should this by MySearcher1?oValue.Add(Microsoft.VisualBasic.Right(result.GetD irectoryEntry().Name,
Len(result.GetDirectoryEntry().Name) - 3))
Next
User1.DataSource = oValue
User1.Visible = True
这篇关于Web应用程序中的AD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!