Windows autentication with WindowsPrinicipal

Discussion in 'ASP .Net Security' started by naijacoder naijacoder, Aug 30, 2004.

  1. Hello,
    I'm using Windows Authenetication with my code below with
    Windows Principal.
    I noticed that when i use IsinRole with "BUILT\Administrator its does
    work fine but when i use
    DomainName\GroupName it doesn't go.
    Does anybody know what 'm doing wrong?
    Pls forward ur ideas!
    Thanks

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here
    'Dim UserName As String = wp.Name
    Dim wp As New WindowsPrincipal(WindowsIdentity.GetCurrent())
    'If wp.IsInRole("DomainName\GroupName") Then
    If wp.IsInRole("BUILTIN\Administrators") Then
    'code
    Response.Redirect("welcome.aspx")

    End If
    If wp.IsInRole("BUILTIN\dministrators") Then
    'code
    Response.Redirect("Nowelcome.aspx")

    End If

    End Sub

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    naijacoder naijacoder, Aug 30, 2004
    #1
    1. Advertising

  2. Are you using impersonation in your web.config?

    --
    - Paul Glavich
    Microsoft MVP - ASP.NET


    "naijacoder naijacoder" <> wrote in message
    news:...
    > Hello,
    > I'm using Windows Authenetication with my code below with
    > Windows Principal.
    > I noticed that when i use IsinRole with "BUILT\Administrator its does
    > work fine but when i use
    > DomainName\GroupName it doesn't go.
    > Does anybody know what 'm doing wrong?
    > Pls forward ur ideas!
    > Thanks
    >
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles MyBase.Load
    > 'Put user code to initialize the page here
    > 'Dim UserName As String = wp.Name
    > Dim wp As New WindowsPrincipal(WindowsIdentity.GetCurrent())
    > 'If wp.IsInRole("DomainName\GroupName") Then
    > If wp.IsInRole("BUILTIN\Administrators") Then
    > 'code
    > Response.Redirect("welcome.aspx")
    >
    > End If
    > If wp.IsInRole("BUILTIN\dministrators") Then
    > 'code
    > Response.Redirect("Nowelcome.aspx")
    >
    > End If
    >
    > End Sub
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    Paul Glavich [MVP - ASP.NET], Sep 2, 2004
    #2
    1. Advertising

  3. Hi Paul,
    Yeah i wasn't doing impersonation.
    Did that and its working fine!
    Thx


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    naijacoder naijacoder, Sep 2, 2004
    #3
    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. NWx
    Replies:
    1
    Views:
    540
    Saravana [MVP]
    Feb 13, 2004
  2. Jeff Dillon

    Autentication dialog

    Jeff Dillon, Nov 4, 2004, in forum: ASP .Net
    Replies:
    14
    Views:
    503
    Bliss
    Nov 20, 2004
  3. Replies:
    7
    Views:
    4,162
  4. NWx
    Replies:
    1
    Views:
    159
    Saravana [MVP]
    Feb 13, 2004
  5. naija naija

    Windows autentication PROBLEMS

    naija naija, Aug 31, 2004, in forum: ASP .Net Security
    Replies:
    0
    Views:
    109
    naija naija
    Aug 31, 2004
Loading...

Share This Page