通过Active Directory进行Windows身份验证 [英] Windows Authentication through Active Directory

查看:123
本文介绍了通过Active Directory进行Windows身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,请帮助我..这很紧急

这是Hriday,正在使用

Active Directory进行Windows身份验证...

我的要求是当用户向我的网站发送请求时

Applicatoin我想弹出Windows身份验证框这样

用户将提供他的userId,密码&域名

authenticnticaion。之后我想拿这三个信息

用户并在Active Directory中搜索。


我可以通过使用显示Win身份验证弹出窗口

身份验证模式=" Windows"在Authrization标签中,

deny user ="?"在
IIS中设置Win集成身份验证。


但是我无法从Win获取用户的信息

验证弹出窗口......我使用服务器变量

AUTH_USER并获得userId。但是当我使用AUTH_PASSWORD我

得到空值...


有人可以告诉我如何获取密码和域名

值表单Windows Authenticaion Box ....


如果这不可行...如何在没有

密码和域名的情况下进行搜索..在活动目录....


我复制我的代码以检索用户信息表格活动

目录。请帮帮我......很紧急。


Public Sub GetUserDetails(ByVal domain As String,ByVal

用户名为String,ByVal pwd As String)

Dim domainAndUsername As [String] = domain& " \" &

用户名


专用路径为字符串

=" LDAP:// AD / DC = AD,DC = SOLVERSA,DC = COM"

Dim entry As New DirectoryEntry(路径,

domainAndUsername,pwd)


尝试

''绑定到原生AdsObject以强制

身份验证。

Dim obj As Object = entry.NativeObject


昏暗搜索As New DirectorySearcher(条目)

search.Filter ="(SAMAccountName ="& username

&")" ;

search.PropertiesToLoad.Add(" cn")

Dim results As SearchResult = search.FindOne()


''在

目录中更新用户的新路径。

path = result.Path

filterAttribute = CType(result.Properties( " cn")

(0),String)

fullname = CType(result.Properties(" cn")(0),

String)

search.PropertiesToLoad.Add(" mail")

Dim resultemail作为SearchResult =

search.FindOne()

email = CType(resultemail.Properties(" mail")

(0),String)


search.PropertiesToLoad.Add(" MemberOf")

Dim resultgp As SearchResult = search.FindOne()

groupName = CType(resultgp.Properties

(" MemberOf")(0),String)


Catch ex As例外

''抛出新例外(获取用户时出错

详细信息。 " + ex.Message)

结束尝试


End Sub''GetUserDetails

Hi there, Please help me..It is urgent
This is Hriday, working on windows authentication with
Active Directory...
My requirment is when a user sends a request to my web
Applicatoin I want to Pop up windows Authentication box so
that user will give his userId, Password & domain name for
authenticaion. After that I want to take these three info
of user and make a search in Active Directory.

I am able to display Win Authentication Pop up by using
Authentication mode="Windows" and in Authrization tag,
deny user="?" and setting Win Integrated authentication in
IIS.

But I am not able to take user''s info from Win
Authenication Pop-up Windows..as I used server variable
AUTH_USER and got userId. but when I use AUTH_PASSWORD I
am getting null value...

Can some one tell me how to get password and domain fields
value form Windows Authenticaion Box....

If this is not posible ... how can I make a search without
password and domain..in Active directory ....

I copy my code for retrieving user info form Active
Directory. Please help me..It is urgent.

Public Sub GetUserDetails(ByVal domain As String, ByVal
username As String, ByVal pwd As String)
Dim domainAndUsername As [String] = domain & "\" &
username

Private path As String
= "LDAP://AD/DC=AD,DC=SOLVERSA,DC=COM"
Dim entry As New DirectoryEntry(path,
domainAndUsername, pwd)

Try
''Bind to the native AdsObject to force
authentication.
Dim obj As Object = entry.NativeObject

Dim search As New DirectorySearcher(entry)

search.Filter = "(SAMAccountName=" & username
& ")"
search.PropertiesToLoad.Add("cn")
Dim result As SearchResult = search.FindOne()

''Update the new path to the user in the
directory.
path = result.Path
filterAttribute = CType(result.Properties("cn")
(0), String)
fullname = CType(result.Properties("cn")(0),
String)
search.PropertiesToLoad.Add("mail")
Dim resultemail As SearchResult =
search.FindOne()
email = CType(resultemail.Properties("mail")
(0), String)

search.PropertiesToLoad.Add("MemberOf")
Dim resultgp As SearchResult = search.FindOne()
groupName = CType(resultgp.Properties
("MemberOf")(0), String)

Catch ex As Exception
''Throw New Exception("Error obtaining user
details. " + ex.Message)
End Try

End Sub ''GetUserDetails

推荐答案

嗨Hriday,


我使用IsInRole要在MSDN上找到这些页面,你可以用这个作为开始

的地方来检查这是否对你有帮助吗?


Cor
Hi Hriday,

I use "IsInRole" to find these pages on MSDN, can you use this as a start
place to check if this can help you?

Cor

这是Hriday,使用
Active Directory进行Windows身份验证...
我的要求是当用户向我的网站发送请求时
Applicatoin I想要弹出Windows身份验证框,那么用户将给他的userId,密码&
authenticnticaion的域名。之后我想拿这三个用户信息并在Active Directory中搜索。

我可以通过使用
身份验证模式显示Win身份验证模式=" ;视窗"在Authrization标签中,
deny user ="?"在IIS中设置Win集成身份验证。

但我无法从Win
Authenication Pop-up Windows中获取用户信息。我使用的是服务器变量
AUTH_USER并获得了userId。但是当我使用AUTH_PASSWORD时,我正在获得空值...

有人可以告诉我如何获取密码和域名
价值形式Windows Authenticaion Box ....

如果这不可行......如何在没有密码和域名的情况下进行搜索..在Active目录中....

我复制我的用于检索用户信息表单的代码Active
目录。请帮帮我......很紧急。

Public Sub GetUserDetails(ByVal domain As String,ByVal
用户名为字符串,ByVal pwd为字符串)
Dim domainAndUsername As [String] =域名& " \" &
用户名

私人路径为字符串
=" LDAP:// AD / DC = AD,DC = SOLVERSA,DC = COM"
昏暗的条目作为New DirectoryEntry(路径,
domainAndUsername,pwd)

尝试
''绑定到原生AdsObject以强制
身份验证。
Dim obj As Object = entry.NativeObject

Dim search As New DirectorySearcher(条目)

search.Filter ="(SAMAccountName ="& username
&" )"
search.PropertiesToLoad.Add(" cn")
Dim result As SearchResult = search.FindOne()

''更新用户的新路径
目录。
path = result.Path
filterAttribute = CType(result.Properties(" cn")
(0),String)
fullname = CType (result.Properties(" cn")(0),
String)
search.Properti esToLoad.Add(mail)
Dim resultemail作为SearchResult =
search.FindOne()
email = CType(resultemail.Properties(" mail)
(0 ),String)

search.PropertiesToLoad.Add(" MemberOf")
Dim resultgp As SearchResult = search.FindOne()
groupName = CType(resultgp.Properties
(" MemberOf")(0),String)

Catch ex As Exception
''抛出新的异常(获取用户的错误详情。 " + ex.Message)
结束尝试

End Sub''GetUserDetails

This is Hriday, working on windows authentication with
Active Directory...
My requirment is when a user sends a request to my web
Applicatoin I want to Pop up windows Authentication box so
that user will give his userId, Password & domain name for
authenticaion. After that I want to take these three info
of user and make a search in Active Directory.

I am able to display Win Authentication Pop up by using
Authentication mode="Windows" and in Authrization tag,
deny user="?" and setting Win Integrated authentication in
IIS.

But I am not able to take user''s info from Win
Authenication Pop-up Windows..as I used server variable
AUTH_USER and got userId. but when I use AUTH_PASSWORD I
am getting null value...

Can some one tell me how to get password and domain fields
value form Windows Authenticaion Box....

If this is not posible ... how can I make a search without
password and domain..in Active directory ....

I copy my code for retrieving user info form Active
Directory. Please help me..It is urgent.

Public Sub GetUserDetails(ByVal domain As String, ByVal
username As String, ByVal pwd As String)
Dim domainAndUsername As [String] = domain & "\" &
username

Private path As String
= "LDAP://AD/DC=AD,DC=SOLVERSA,DC=COM"
Dim entry As New DirectoryEntry(path,
domainAndUsername, pwd)

Try
''Bind to the native AdsObject to force
authentication.
Dim obj As Object = entry.NativeObject

Dim search As New DirectorySearcher(entry)

search.Filter = "(SAMAccountName=" & username
& ")"
search.PropertiesToLoad.Add("cn")
Dim result As SearchResult = search.FindOne()

''Update the new path to the user in the
directory.
path = result.Path
filterAttribute = CType(result.Properties("cn")
(0), String)
fullname = CType(result.Properties("cn")(0),
String)
search.PropertiesToLoad.Add("mail")
Dim resultemail As SearchResult =
search.FindOne()
email = CType(resultemail.Properties("mail")
(0), String)

search.PropertiesToLoad.Add("MemberOf")
Dim resultgp As SearchResult = search.FindOne()
groupName = CType(resultgp.Properties
("MemberOf")(0), String)

Catch ex As Exception
''Throw New Exception("Error obtaining user
details. " + ex.Message)
End Try

End Sub ''GetUserDetails



您好Hriday,


我使用IsInRole要在MSDN上找到这些页面,你可以用这个作为开始

的地方来检查这是否对你有帮助吗?


Cor
Hi Hriday,

I use "IsInRole" to find these pages on MSDN, can you use this as a start
place to check if this can help you?

Cor

这是Hriday,使用
Active Directory进行Windows身份验证...
我的要求是当用户向我的网站发送请求时
Applicatoin I想要弹出Windows身份验证框,那么用户将给他的userId,密码&
authenticnticaion的域名。之后我想拿这三个用户信息并在Active Directory中搜索。

我可以通过使用
身份验证模式显示Win身份验证模式=" ;视窗"在Authrization标签中,
deny user ="?"在IIS中设置Win集成身份验证。

但我无法从Win
Authenication Pop-up Windows中获取用户信息。我使用的是服务器变量
AUTH_USER并获得了userId。但是当我使用AUTH_PASSWORD时,我正在获得空值...

有人可以告诉我如何获取密码和域名
价值形式Windows Authenticaion Box ....

如果这不可行......如何在没有密码和域名的情况下进行搜索..在Active目录中....

我复制我的用于检索用户信息表单的代码Active
目录。请帮帮我......很紧急。

Public Sub GetUserDetails(ByVal domain As String,ByVal
用户名为字符串,ByVal pwd为字符串)
Dim domainAndUsername As [String] =域名& " \" &
用户名

私人路径为字符串
=" LDAP:// AD / DC = AD,DC = SOLVERSA,DC = COM"
昏暗的条目作为New DirectoryEntry(路径,
domainAndUsername,pwd)

尝试
''绑定到原生AdsObject以强制
身份验证。
Dim obj As Object = entry.NativeObject

Dim search As New DirectorySearcher(条目)

search.Filter ="(SAMAccountName ="& username
&" )"
search.PropertiesToLoad.Add(" cn")
Dim result As SearchResult = search.FindOne()

''更新用户的新路径
目录。
path = result.Path
filterAttribute = CType(result.Properties(" cn")
(0),String)
fullname = CType (result.Properties(" cn")(0),
String)
search.Properti esToLoad.Add(mail)
Dim resultemail作为SearchResult =
search.FindOne()
email = CType(resultemail.Properties(" mail)
(0 ),String)

search.PropertiesToLoad.Add(" MemberOf")
Dim resultgp As SearchResult = search.FindOne()
groupName = CType(resultgp.Properties
(" MemberOf")(0),String)

Catch ex As Exception
''抛出新的异常(获取用户的错误详情。 " + ex.Message)
结束尝试

End Sub''GetUserDetails

This is Hriday, working on windows authentication with
Active Directory...
My requirment is when a user sends a request to my web
Applicatoin I want to Pop up windows Authentication box so
that user will give his userId, Password & domain name for
authenticaion. After that I want to take these three info
of user and make a search in Active Directory.

I am able to display Win Authentication Pop up by using
Authentication mode="Windows" and in Authrization tag,
deny user="?" and setting Win Integrated authentication in
IIS.

But I am not able to take user''s info from Win
Authenication Pop-up Windows..as I used server variable
AUTH_USER and got userId. but when I use AUTH_PASSWORD I
am getting null value...

Can some one tell me how to get password and domain fields
value form Windows Authenticaion Box....

If this is not posible ... how can I make a search without
password and domain..in Active directory ....

I copy my code for retrieving user info form Active
Directory. Please help me..It is urgent.

Public Sub GetUserDetails(ByVal domain As String, ByVal
username As String, ByVal pwd As String)
Dim domainAndUsername As [String] = domain & "\" &
username

Private path As String
= "LDAP://AD/DC=AD,DC=SOLVERSA,DC=COM"
Dim entry As New DirectoryEntry(path,
domainAndUsername, pwd)

Try
''Bind to the native AdsObject to force
authentication.
Dim obj As Object = entry.NativeObject

Dim search As New DirectorySearcher(entry)

search.Filter = "(SAMAccountName=" & username
& ")"
search.PropertiesToLoad.Add("cn")
Dim result As SearchResult = search.FindOne()

''Update the new path to the user in the
directory.
path = result.Path
filterAttribute = CType(result.Properties("cn")
(0), String)
fullname = CType(result.Properties("cn")(0),
String)
search.PropertiesToLoad.Add("mail")
Dim resultemail As SearchResult =
search.FindOne()
email = CType(resultemail.Properties("mail")
(0), String)

search.PropertiesToLoad.Add("MemberOf")
Dim resultgp As SearchResult = search.FindOne()
groupName = CType(resultgp.Properties
("MemberOf")(0), String)

Catch ex As Exception
''Throw New Exception("Error obtaining user
details. " + ex.Message)
End Try

End Sub ''GetUserDetails



2004年6月24日星期四23 :08:12-0700,Hriday < HR ******** @ yahoo.com>写道:

$ b $b¤你好,请帮助我......很紧急
$ b $b¤
$ b $b¤
$ b $b¤这是Hriday,使用

进行Windows身份验证¤ActiveDirectory ...
$ b $b¤我的要求是当用户向我的网站发送请求时
$ b $b¤Appsatoin我想弹出Windows身份验证框,以便用户将给他的userId,密码&域名
$ b $b¤认证。在那之后我想拿这三个信息用户并在Active Directory中搜索。
$ b $b¤
$ b $b¤我能够显示Win身份验证弹出使用
$ b $b¤身份验证模式=" Windows"在Authrization标签中,
$ b $b¤denyuser ="?"在
·IIS中设置Win集成身份验证。
$ b $b¤
$ b $b¤但是我无法从Win获取用户的信息
$ b $b¤认证弹出Windows ..我使用服务器变量
$ b $b¤AUTH_USER并获得userId。但是,当我使用AUTH_PASSWORD时,我将获得空值...


使用基于Windows的集成窗口时,无法从登录对话框获取密码$>
身份验证。


如果要捕获用户ID和密码,则必须使用基于表单的身份验证:

http:// samples。 gotdotnet.com/quickst...formsauth.aspx

Paul ~~~ pc ** ****@ameritech.net

Microsoft MVP(Visual Basic)
On Thu, 24 Jun 2004 23:08:12 -0700, "Hriday" <hr********@yahoo.com> wrote:

¤ Hi there, Please help me..It is urgent
¤
¤
¤ This is Hriday, working on windows authentication with
¤ Active Directory...
¤ My requirment is when a user sends a request to my web
¤ Applicatoin I want to Pop up windows Authentication box so
¤ that user will give his userId, Password & domain name for
¤ authenticaion. After that I want to take these three info
¤ of user and make a search in Active Directory.
¤
¤ I am able to display Win Authentication Pop up by using
¤ Authentication mode="Windows" and in Authrization tag,
¤ deny user="?" and setting Win Integrated authentication in
¤ IIS.
¤
¤ But I am not able to take user''s info from Win
¤ Authenication Pop-up Windows..as I used server variable
¤ AUTH_USER and got userId. but when I use AUTH_PASSWORD I
¤ am getting null value...

You cannot obtain the password from the login dialog when using integrated Windows based
authentication.

If you want to capture the user ID and password you will have to use Forms based authentication:

http://samples.gotdotnet.com/quickst...formsauth.aspx
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)


这篇关于通过Active Directory进行Windows身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆