Active Directory and getobject("WinNT://"

Discussion in 'ASP General' started by Jeff, Feb 3, 2006.

  1. Jeff

    Jeff Guest

    All,

    I have a simple ASP web application that has been working great for
    years, and now we are moving to Active Directory. The following code
    is in my global.asa file, but is not working anymore. Note, although
    we have upgraded to AD, the usernames have stayed the same.

    Sub Session_OnStart
    '**Session on Start code here **
    strUsername=Replace(ucase(Request.ServerVariables("LOGON_USER")) ,
    "\", "/")
    set adsUser = getobject("WinNT://" & strUsername)
    for each group in adsUser.groups
    GrpList = GrpList & ucase(trim(group.name)) & ";"
    next
    if instr(GrpList ,"MYGROUP") then
    Session("ok") = "OK"
    else
    Response.Redirect "notauthorized.htm"
    end if
    End Sub

    Any help would be greatly appreciated!

    Jeff
     
    Jeff, Feb 3, 2006
    #1
    1. Advertising

  2. What does "not working" mean? Do you get an error? If so, what does it
    say?

    Ray at work

    "Jeff" <> wrote in message
    news:...
    > All,
    >
    > I have a simple ASP web application that has been working great for
    > years, and now we are moving to Active Directory. The following code
    > is in my global.asa file, but is not working anymore. Note, although
    > we have upgraded to AD, the usernames have stayed the same.
    >
    > Sub Session_OnStart
    > '**Session on Start code here **
    > strUsername=Replace(ucase(Request.ServerVariables("LOGON_USER")) ,
    > "\", "/")
    > set adsUser = getobject("WinNT://" & strUsername)
    > for each group in adsUser.groups
    > GrpList = GrpList & ucase(trim(group.name)) & ";"
    > next
    > if instr(GrpList ,"MYGROUP") then
    > Session("ok") = "OK"
    > else
    > Response.Redirect "notauthorized.htm"
    > end if
    > End Sub
    >
    > Any help would be greatly appreciated!
    >
    > Jeff
    >
     
    Ray Costanzo [MVP], Feb 3, 2006
    #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.
Similar Threads
  1. ejcosta
    Replies:
    2
    Views:
    876
    Eurico Costa
    Oct 8, 2004
  2. Hakan
    Replies:
    6
    Views:
    446
    Hakan
    Jan 30, 2004
  3. David Lozzi

    Difference in IIS5 and IIS6, GetObject errors

    David Lozzi, Feb 25, 2004, in forum: ASP General
    Replies:
    0
    Views:
    127
    David Lozzi
    Feb 25, 2004
  4. Blake
    Replies:
    2
    Views:
    280
    Egbert Nierop \(MVP for IIS\)
    Jun 1, 2004
  5. Bohous
    Replies:
    1
    Views:
    206
    Jeff Cochran
    Sep 2, 2005
Loading...

Share This Page