authenticateUser

Discussion in 'ASP General' started by Andy, Jun 22, 2005.

  1. Andy

    Andy Guest

    Hi,

    Does anybody know how to use the function authenticateUser in asp?

    When I load my asp page, it should pass the logged on user to a variable
    called 'vCreator' which should then be shown within a textbox on the screen.

    My code for this section is as follows, but for some reason the field
    appears blank???
    ***************
    We run on AD 2003 in mixed mode

    authenticateUser Request.ServerVariables("LOGON_USER")

    Sub authenticateUser(nt_user)
    Dim slashpos, spacepos, nt_user1, nt_userfirst, nt_userlast
    slashpos = instr(nt_user,"\")
    if slashpos <> 0 then
    nt_user1 = mid(nt_user, slashpos + 1, len(nt_user)-(slashpos))
    spacepos = instr(nt_user1," ")
    end if
    if spacepos <> 0 then
    nt_userlast = Right(nt_user1, len(nt_user1) - (spacepos))

    nt_userfirst = mid(nt_user, 4, spacepos)
    end if
    vCreator = nt_user1
    vFrom = nt_userfirst & "." & nt_userlast & "@eastbourne.gov.uk"
    End Sub
    *************

    Thanks

    Andy
    Andy, Jun 22, 2005
    #1
    1. Advertising

  2. Hi Andy,

    1. Make sure you have anonymous access turned off in IIS.
    2. You're calling a sub that assigns a value to a variable (global scope?)
    Are you writing that variable anywhere? Have you considered writing this as
    a function?


    Function Email(nt_user)
    If nt_user <> "" Then Email = Split(nt_user & "\", "\")(1) &
    "@eastbourne.gov.uk"
    End Function

    Do you really have usernames with spaces in them?

    Ray at work

    "Andy" <> wrote in message
    news:42b962ce$0$150$...
    > Hi,
    >
    > Does anybody know how to use the function authenticateUser in asp?
    >
    > When I load my asp page, it should pass the logged on user to a variable
    > called 'vCreator' which should then be shown within a textbox on the

    screen.
    >
    > My code for this section is as follows, but for some reason the field
    > appears blank???
    > ***************
    > We run on AD 2003 in mixed mode
    >
    > authenticateUser Request.ServerVariables("LOGON_USER")
    >
    > Sub authenticateUser(nt_user)
    > Dim slashpos, spacepos, nt_user1, nt_userfirst, nt_userlast
    > slashpos = instr(nt_user,"\")
    > if slashpos <> 0 then
    > nt_user1 = mid(nt_user, slashpos + 1, len(nt_user)-(slashpos))
    > spacepos = instr(nt_user1," ")
    > end if
    > if spacepos <> 0 then
    > nt_userlast = Right(nt_user1, len(nt_user1) - (spacepos))
    >
    > nt_userfirst = mid(nt_user, 4, spacepos)
    > end if
    > vCreator = nt_user1
    > vFrom = nt_userfirst & "." & nt_userlast & "@eastbourne.gov.uk"
    > End Sub
    > *************
    >
    > Thanks
    >
    > Andy
    >
    >
    Ray Costanzo [MVP], Jun 22, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page