using AD security for authentication. The trust relationship betweenthe primary domain and the trust

Discussion in 'ASP .Net' started by wildman@noclient.net, Feb 29, 2008.

  1. Guest

    Hello.

    Simple security design, where all intranet users can get to most
    pages, but a few ADMIN pages need to be secured to select users. We've
    added those users to an AD group.

    Whle testing I noticed this returns YES

    If (Page.User.IsInRole("USERS")) Then
    Response.Write("YES")
    Else
    Response.Write("NO")
    End If

    and so does this, because im under the admnistrators group on my local
    client;

    If (Page.User.IsInRole("ADMINISTRATORS")) Then
    Response.Write("YES")
    Else
    Response.Write("NO")
    End If


    However, this test (on a group that does not exsist) results in the
    error:

    The trust relationship between the primary domain and the trusted
    domain failed.


    If (Page.User.IsInRole("XXX")) Then
    Response.Write("YES")
    Else
    Response.Write("NO")
    End If


    I having the network admins add my user to new AD group to test this
    out, but am wondering if this is really checking AD groups or just
    local groups and what that above error might mean.

    Thanks for any help or information.
    , Feb 29, 2008
    #1
    1. Advertising

  2. Guest

    Re: using AD security for authentication. The trust relationshipbetween the primary domain and the trusted domain failed.

    Do I have to use System.DirectoryServices to check if a my intranet
    user is in an AD group?

    If so, I'm trying this:

    Dim domainAndUsername As String = Page.User.Identity.Name.ToString
    Dim DirectorySearcher As New
    System.DirectoryServices.DirectorySearcher()
    Dim LDAPPATH As String = DirectorySearcher.SearchRoot.Path

    Dim entry As New
    System.DirectoryServices.DirectoryEntry(LDAPPATH, domainAndUsername,
    "xxxx")

    Dim obj As Object = entry.NativeObject
    Dim search As System.DirectoryServices.DirectorySearcher = New
    System.DirectoryServices.DirectorySearcher(entry)
    search.Filter = "(SAMAccountName=yyyy)"
    search.PropertiesToLoad.Add("cn") ' ????
    Dim result As System.DirectoryServices.SearchResult =
    search.FindOne()

    If result Is Nothing Then
    Response.Write("Nothing")
    Else
    Response.Write(result.Properties.Item("???").ToString())
    End If

    The above is not working, I know it's missing stuff. I'm not clear on
    how to search or what to look for.

    Thanks for any help or information.
    , Feb 29, 2008
    #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. Steve M
    Replies:
    3
    Views:
    27,393
    dar7ren
    May 27, 2009
  2. =?Utf-8?B?bXVzb3NkZXY=?=

    vs2005: domain trust relationship problem

    =?Utf-8?B?bXVzb3NkZXY=?=, Jan 12, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    4,501
    Steven Cheng[MSFT]
    Jan 17, 2006
  3. =?ISO-8859-1?Q?KLEIN_St=E9phane?=
    Replies:
    3
    Views:
    439
    hanumizzle
    Oct 6, 2006
  4. Namshub
    Replies:
    1
    Views:
    776
    Joe Kaplan \(MVP - ADSI\)
    Jun 28, 2006
  5. MrGrundh
    Replies:
    0
    Views:
    1,143
    MrGrundh
    Aug 27, 2009
Loading...

Share This Page