Fullname of current user

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Leszek

    Fullname of current user

    Hello!

    I have my webpage (ASP) in domain (IIS 6.0).
    I need to make a popup with fullname of current user.
    How can I do this?
    Maybe someone have any examples?

    Thanks!


  • James Jones

    #2
    Re: Fullname of current user

    by current user, do you mean you want the current user of the user account
    on windows, or you want the full name of the current user browsing your
    website?



    "Leszek" <marek@zegarek. comwrote in message
    news:%23FTHYwjt GHA.4544@TK2MSF TNGP04.phx.gbl. ..
    Hello!
    >
    I have my webpage (ASP) in domain (IIS 6.0).
    I need to make a popup with fullname of current user.
    How can I do this?
    Maybe someone have any examples?
    >
    Thanks!
    >

    Comment

    • Leszek

      #3
      Re: Fullname of current user

      I want the fullname of the user browsing this page.
      IIS is set to Windows Authentication.

      BTW. In 99,99% both accounts (for login to Windows and for browsing page)
      Will be the same.

      U¿ytkownik "James Jones" <jamisonburrous 08@insightbb.co mnapisa³ w
      wiadomo¶ci news:ey4sK0jtGH A.5044@TK2MSFTN GP05.phx.gbl...
      by current user, do you mean you want the current user of the user account
      on windows, or you want the full name of the current user browsing your
      website?
      >
      >
      >
      "Leszek" <marek@zegarek. comwrote in message
      news:%23FTHYwjt GHA.4544@TK2MSF TNGP04.phx.gbl. ..
      >Hello!
      >>
      >I have my webpage (ASP) in domain (IIS 6.0).
      >I need to make a popup with fullname of current user.
      >How can I do this?
      >Maybe someone have any examples?
      >>
      >Thanks!
      >>
      >
      >

      Comment

      • Slim

        #4
        Re: Fullname of current user

        not easy.

        do you have any expirance in COM+?

        if so i have made a COM+ component that wil do the job, it will also let
        your users change passwords from the internet.

        code is below , make sure you change this line to suit your domain

        "SELECT distinguishedNa me FROM 'LDAP://dc=yourdomain,d c=local'

        you will need to save this code in VB as a activeX dll, the register it in
        component services,

        then call it in your asp page like this

        dim dUser
        dUser = Request.ServerV ariables("REMOT E_USER")
        dim ADSI
        Set ADSI = Server.CreateOb ject("ADSI.User ")
        Response.Write ADSI.getFullNam e( CStr( dUser))




        Function getFullName(use rName As String) As String
        On Error Resume Next
        Dim oUser: Set oUser = GetObject("LDAP ://" & getUserDN(CStr( userName)))
        getFullName = oUser.FullName
        End Function

        Function changePassword( userName As String, existingPasswor d As String,
        newPassword As String) As Boolean
        On Error Resume Next
        Dim oUser: Set oUser = GetObject("LDAP ://" & getUserDN(CStr( userName)))
        oUser.changePas sword existingPasswor d, newPassword
        oUser.SetInfo
        If Err.Number = 0 Then
        changePassword = True
        Else
        changePassword = False
        End If
        End Function


        Function getUserDN(userN ame As String) As String
        On Error Resume Next
        Const ADS_SCOPE_SUBTR EE = 10
        Set objConnection = CreateObject("A DODB.Connection ")
        Set objCommand = CreateObject("A DODB.Command")
        objConnection.P rovider = "ADsDSOObje ct"
        objConnection.O pen "Active Directory Provider"
        Set objCommand.Acti veConnection = objConnection
        objCommand.Prop erties("Page Size") = 1000
        objCommand.Prop erties("Searchs cope") = ADS_SCOPE_SUBTR EE
        objCommand.Comm andText = _
        "SELECT distinguishedNa me FROM 'LDAP://dc=yourdomain,d c=local' WHERE
        objectCategory= 'user' " & _
        "AND sAMAccountName= '" & userName & "'"
        Set objRecordSet = objCommand.Exec ute
        Dim ans
        objRecordSet.Mo veFirst
        Do Until objRecordSet.EO F
        ans = objRecordSet.Fi elds("distingui shedName").Valu e
        objRecordSet.Mo veNext
        Loop
        getUserDN = ans
        End Function










        "Leszek" <marek@zegarek. comwrote in message
        news:OAQhv2jtGH A.2260@TK2MSFTN GP02.phx.gbl...
        >I want the fullname of the user browsing this page.
        IIS is set to Windows Authentication.
        >
        BTW. In 99,99% both accounts (for login to Windows and for browsing page)
        Will be the same.
        >
        U¿ytkownik "James Jones" <jamisonburrous 08@insightbb.co mnapisa³ w
        wiadomo¶ci news:ey4sK0jtGH A.5044@TK2MSFTN GP05.phx.gbl...
        >by current user, do you mean you want the current user of the user
        >account on windows, or you want the full name of the current user
        >browsing your website?
        >>
        >>
        >>
        >"Leszek" <marek@zegarek. comwrote in message
        >news:%23FTHYwj tGHA.4544@TK2MS FTNGP04.phx.gbl ...
        >>Hello!
        >>>
        >>I have my webpage (ASP) in domain (IIS 6.0).
        >>I need to make a popup with fullname of current user.
        >>How can I do this?
        >>Maybe someone have any examples?
        >>>
        >>Thanks!
        >>>
        >>
        >>
        >
        >

        Comment

        • Leszek

          #5
          Re: Fullname of current user

          I made it other way, but thanks for help!

          sub br()
          Response.Write( "<br/>")
          end sub
          sub prln(text)
          pr(text)
          ' br()
          end sub

          dim GLOBAL_redirect
          dim usrTab
          Dim CONTAINER
          Dim domain, user
          Dim objConnection, objComman, objRecordSet
          Dim lewo, prawo, czesc
          Const ADS_SCOPE_SUBTR EE = 2

          redirect=false
          set userFull = Request.ServerV ariables("LOGON _USER")

          usrTab = Split(userFull, "\")
          Set obj = CreateObject("W Script.Network" )
          domain = usrTab(0)
          user = usrTab(1)
          CONTAINER = "dc=" & domain & ",dc=pl"
          Set objConnection = CreateObject("A DODB.Connection ")
          Set objCommand = CreateObject("A DODB.Command")
          objConnection.P rovider = "ADsDSOObje ct"
          objConnection.O pen "Active Directory Provider"
          Set objCommand.Acti veConnection = objConnection
          objCommand.Comm andText = "Select distinguishedNa me from " & "'LDAP://" &
          CONTAINER & "' where objectClass='us er' AND samAccountName= '" & user & "'"
          objCommand.Prop erties("Page Size") = 1000
          objCommand.Prop erties("Timeout ") = 30
          objCommand.Prop erties("Searchs cope") = ADS_SCOPE_SUBTR EE
          objCommand.Prop erties("Cache Results") = False
          Set objRecordSet = objCommand.Exec ute
          objRecordSet.Mo veFirst
          if not objRecordSet.EO F then
          else
          end if

          lewo = objrecordset.Fi elds("distingui shedName").Valu e
          Dim tablica1, tablica2
          tablica1 = Split(lewo, ",")
          tablica2 = Split(CStr(tabl ica1(0)), "=")
          prln(tablica2(1 ))



          U¿ytkownik "Slim" <me@here.comnap isa³ w wiadomo¶ci
          news:%23MSznMkt GHA.4336@TK2MSF TNGP06.phx.gbl. ..
          not easy.
          >
          do you have any expirance in COM+?
          >
          if so i have made a COM+ component that wil do the job, it will also let
          your users change passwords from the internet.
          >
          code is below , make sure you change this line to suit your domain
          >
          "SELECT distinguishedNa me FROM 'LDAP://dc=yourdomain,d c=local'
          >
          you will need to save this code in VB as a activeX dll, the register it in
          component services,
          >
          then call it in your asp page like this
          >
          dim dUser
          dUser = Request.ServerV ariables("REMOT E_USER")
          dim ADSI
          Set ADSI = Server.CreateOb ject("ADSI.User ")
          Response.Write ADSI.getFullNam e( CStr( dUser))
          >
          >
          >
          >
          Function getFullName(use rName As String) As String
          On Error Resume Next
          Dim oUser: Set oUser = GetObject("LDAP ://" & getUserDN(CStr( userName)))
          getFullName = oUser.FullName
          End Function
          >
          Function changePassword( userName As String, existingPasswor d As String,
          newPassword As String) As Boolean
          On Error Resume Next
          Dim oUser: Set oUser = GetObject("LDAP ://" & getUserDN(CStr( userName)))
          oUser.changePas sword existingPasswor d, newPassword
          oUser.SetInfo
          If Err.Number = 0 Then
          changePassword = True
          Else
          changePassword = False
          End If
          End Function
          >
          >
          Function getUserDN(userN ame As String) As String
          On Error Resume Next
          Const ADS_SCOPE_SUBTR EE = 10
          Set objConnection = CreateObject("A DODB.Connection ")
          Set objCommand = CreateObject("A DODB.Command")
          objConnection.P rovider = "ADsDSOObje ct"
          objConnection.O pen "Active Directory Provider"
          Set objCommand.Acti veConnection = objConnection
          objCommand.Prop erties("Page Size") = 1000
          objCommand.Prop erties("Searchs cope") = ADS_SCOPE_SUBTR EE
          objCommand.Comm andText = _
          "SELECT distinguishedNa me FROM 'LDAP://dc=yourdomain,d c=local'
          WHERE objectCategory= 'user' " & _
          "AND sAMAccountName= '" & userName & "'"
          Set objRecordSet = objCommand.Exec ute
          Dim ans
          objRecordSet.Mo veFirst
          Do Until objRecordSet.EO F
          ans = objRecordSet.Fi elds("distingui shedName").Valu e
          objRecordSet.Mo veNext
          Loop
          getUserDN = ans
          End Function
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          "Leszek" <marek@zegarek. comwrote in message
          news:OAQhv2jtGH A.2260@TK2MSFTN GP02.phx.gbl...
          >>I want the fullname of the user browsing this page.
          >IIS is set to Windows Authentication.
          >>
          >BTW. In 99,99% both accounts (for login to Windows and for browsing page)
          >Will be the same.
          >>
          >U¿ytkownik "James Jones" <jamisonburrous 08@insightbb.co mnapisa³ w
          >wiadomo¶ci news:ey4sK0jtGH A.5044@TK2MSFTN GP05.phx.gbl...
          >>by current user, do you mean you want the current user of the user
          >>account on windows, or you want the full name of the current user
          >>browsing your website?
          >>>
          >>>
          >>>
          >>"Leszek" <marek@zegarek. comwrote in message
          >>news:%23FTHYw jtGHA.4544@TK2M SFTNGP04.phx.gb l...
          >>>Hello!
          >>>>
          >>>I have my webpage (ASP) in domain (IIS 6.0).
          >>>I need to make a popup with fullname of current user.
          >>>How can I do this?
          >>>Maybe someone have any examples?
          >>>>
          >>>Thanks!
          >>>>
          >>>
          >>>
          >>
          >>
          >
          >

          Comment

          Working...