Ask a Question related to ASP.NET Security, Design and Development.
-
naijacoder naijacoder #1
Windows Authentication Question !!
Hi Guys,
I have <%=User.Identity.Name%> on my asp.net page and i can
retrieve the Username for example ComputerName/Username or
DomainName/Username.
But my Question is how can i retrieve the full username for
example "John Brown" or the DisplayName.
Any help from you guys!
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
naijacoder naijacoder Guest
-
ASP.NET Authentication and Windows Authentication
Hello, I'm developing a web application that will run on an Intranet. I'll use Windows Authentication, so users can access the application... -
Windows Authentication Question.
I have windows authentication setup and is working fine except for one problem. If the user wants to login using a different User ID, How do I... -
Authentication under Windows?
Manual quote: "The HTTP Authentication hooks in PHP are only available when it is running as an Apache module and is hence not available in the CGI... -
windows authentication..
Hi I'm stuck with a user authentication issue and desperately need some help. here's the situation - I have a web application where all the users... -
Forms authentication with Windows authentication
Hi, I have an ASP.NET web site that uses IIS Basic Authentication and accesses an OLAP Server at various stages. The OLAP Server authentication... -
Ken Schaefer #2
Re: Windows Authentication Question !!
"naijacoder naijacoder" <naijacoder@toughguy.net> wrote in message
news:OeW2E2EsEHA.1204@TK2MSFTNGP12.phx.gbl...You have to find out where the "DisplayName" is supposed to be coming from.> Hi Guys,
> I have <%=User.Identity.Name%> on my asp.net page and i can
> retrieve the Username for example ComputerName/Username or
> DomainName/Username.
> But my Question is how can i retrieve the full username for
> example "John Brown" or the DisplayName.
> Any help from you guys!
When a user authenticates from their web-browser, it only passes the
username and password (or hash/digest of password), not any of the other
properties that might be stored in Active Directory (AD), or in the local
machine's Security Accounts Manager (SAM) Database. If the information is
stored in AD, you would need to use some code to query AD to get the
properties that you want.
Lots of good info:
[url]http://www.google.com.au/search?q=query+active+directory+using+ASP.NET[/url]
Cheers
Ken
Ken Schaefer Guest
-
Paul Clement #3
Re: Windows Authentication Question !!
On Tue, 12 Oct 2004 04:20:44 -0700, naijacoder naijacoder <naijacoder@toughguy.net> wrote:
¤ Hi Guys,
¤ I have <%=User.Identity.Name%> on my asp.net page and i can
¤ retrieve the Username for example ComputerName/Username or
¤ DomainName/Username.
¤ But my Question is how can i retrieve the full username for
¤ example "John Brown" or the DisplayName.
¤ Any help from you guys!
¤
Dim DomainUser As String =
System.Security.Principal.WindowsIdentity.GetCurre nt.Name.Replace("\", "/")
Dim ADEntry As New System.DirectoryServices.DirectoryEntry("WinNT://" & DomainUser)
Dim FullName As String = ADEntry.Properties("FullName").Value
Paul ~~~ [email]pclement@ameritech.net[/email]
Microsoft MVP (Visual Basic)
Paul Clement Guest
-
Chris #4
Re: Windows Authentication Question !!
Here ya go.
<%
'get the userName from the form
dim userName as String
userName = Request.Form("userName")
dim con, Com, rs, fullName, description
con = Server.CreateObject("ADODB.Connection")
con.provider = "ADsDSOObject"
con.open("Active Directory Provider")
Com = CreateObject("ADODB.Command")
Com.ActiveConnection = con
Com.CommandText = "SELECT displayName, description, cn FROM
'LDAP://DOMAIN NAME/CN=" & userName & ",OU=GROUP NAME' WHERE
sAMAccountname = '" & userName & "'"
rs = Com.Execute
if not rs.bof and not rs.eof then
fullName = rs("displayName").value
description = rs("cn").value
end if
%>
***** MAKE SURE TO CHANGE THE DOMAIN NAME AND GROUP NAME IN THE LDAP
SELECT STATEMENT. ALSO, YOU WILL NEED TO HAVE AN "OU=" FOR EVERY
GROUP IN YOUR AD HIERARCHY.
Chris
naijacoder naijacoder <naijacoder@toughguy.net> wrote in message news:<OeW2E2EsEHA.1204@TK2MSFTNGP12.phx.gbl>...> Hi Guys,
> I have <%=User.Identity.Name%> on my asp.net page and i can
> retrieve the Username for example ComputerName/Username or
> DomainName/Username.
> But my Question is how can i retrieve the full username for
> example "John Brown" or the DisplayName.
> Any help from you guys!
>
>
>
>
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!Chris Guest
-
naijacoder naijacoder #5
Re: Windows Authentication Question !!
Thx for the code..
But the thing is that i need to display THE USER LOGGED ON(ON TOP OF MY
ASP.PAGE)(BUT THE DISPLAY NAME).
I don't want to display LIST of NAMES!
Any ideas?
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
naijacoder naijacoder Guest
-
Joe Kaplan \(MVP - ADSI\) #6
Re: Windows Authentication Question !!
You could use System.DirectoryServices fairly easily to search for the user
by their samAccountName and get their displayName from AD.
The samAccountName is the part to the right of the \ in the user name you
get from Context.User.Identity.Name.
There are tons of samples out there that show how to use the
DirectorySearcher.
Joe K.
"naijacoder naijacoder" <naijacoder@toughguy.net> wrote in message
news:uJfBGxctEHA.2808@TK2MSFTNGP14.phx.gbl...> Thx for the code..
> But the thing is that i need to display THE USER LOGGED ON(ON TOP OF MY
> ASP.PAGE)(BUT THE DISPLAY NAME).
> I don't want to display LIST of NAMES!
> Any ideas?
>
>
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Joe Kaplan \(MVP - ADSI\) Guest
-
Paul Clement #7
Re: Windows Authentication Question !!
On Tue, 19 Oct 2004 04:10:40 -0700, naijacoder naijacoder <naijacoder@toughguy.net> wrote:
¤ Thx for the code..
¤ But the thing is that i need to display THE USER LOGGED ON(ON TOP OF MY
¤ ASP.PAGE)(BUT THE DISPLAY NAME).
¤ I don't want to display LIST of NAMES!
¤ Any ideas?
I have no idea what you are referring to. The FullName, using the NT provider, is the same as the
displayName using the LDAP provider.
Paul ~~~ [email]pclement@ameritech.net[/email]
Microsoft MVP (Visual Basic)
Paul Clement Guest



Reply With Quote

