Windows Authentication Question !!

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default Re: Windows Authentication Question !!


    "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!
    You have to find out where the "DisplayName" is supposed to be coming from.
    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

  4. #3

    Default 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

  5. #4

    Default 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

  6. #5

    Default 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

  7. #6

    Default 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

  8. #7

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139