H
Hriday
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
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