Why won't WindowsPrincipal show as IUSR_<machine> ?

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Re: Why won't WindowsPrincipal show as IUSR_<machine> ?

    It will be IUSER_MACHINE if you leave anonymous turned on in IIS AND enable
    impersonation in your web.config.

    Joe K.

    "Odie" <Odie@discussions.microsoft.com> wrote in message
    news:0256388A-CFC3-4929-9D88-4AA8B0CE72BD@microsoft.com...
    > I have a test harness set up to explore some .Net security stuff.
    > I have an .aspx page w/ .cs code-behind that gets the current Windows
    identity of the asp.net thread:
    > -=-=
    > WindowsIdentity MyIdentity = WindowsIdentity.GetCurrent();
    > WindowsPrincipal MyPrincipal = new WindowsPrincipal(MyIdentity);
    > string Name = MyPrincipal.Identity.Name;
    > string Type = MyPrincipal.Identity.AuthenticationType;
    > string Auth = MyPrincipal.Identity.IsAuthenticated.ToString();
    > //Identity values.
    > string IdentName = MyIdentity.Name;
    > string IdentType = MyIdentity.AuthenticationType;
    > string IdentIsAuth = MyIdentity.IsAuthenticated.ToString();
    > string ISAnon = MyIdentity.IsAnonymous.ToString();
    > -=-=
    >
    > When I have IIS Security set to [anon + integrated security], my test page
    printed out:
    > Principal Name: MYMACHINE\ASPNET
    > Principal Type: NTLM
    > Principal IsAuthenticated: True
    > Identity IsAnonymous: False
    > Identity IsGuest: False
    > Identity IsSystem: False
    >
    > This is good.
    > But when I removed integrated security from IIS Security tab my test page
    still prints out exactly the same thing! Then I remembered asp.net has it's
    own stuff in web.config, so I changed:
    > <authentication mode="Windows" />
    > to
    > <authentication mode="None" />
    >
    > I still get exactly the same output from my test page! Just in case
    there's some weird caching going on here, I shut down my web server and ran
    IISRESET - still to no avail.
    >
    > I can sort of understand the PrincipalName=ASPNET (even though I would
    expect it to be IUSR_MYMACHINE). But I don't understand why it insists on
    having IsAuthenticated=True and IsAnonymous=False.
    >
    > ??
    >

    Joe Kaplan \(MVP - ADSI\) Guest

  2. Similar Questions and Discussions

    1. WindowsPrincipal.IsInRole() is Being Flaky. Help!!
      Its just being inconsistent. I'm in 3 different Groups in AD. ..IsInRole("Groupx") returns true ..IsInRole("Groupy") returns true...
    2. isinrole reverts to windowsprincipal?
      I'm trying to assign all roles (AD and custom pulled from SQL Table) to users when they login to the app using Windows Authentication. The code...
    3. CurrentPrincipal, WindowsPrincipal
      Hello Friend Please check following Cod Dim x As System.Security.Principal.WindowsPrincipa x = System.Threading.Thread.CurrentPrincipa...
    4. IUSR_ Account - Is It Built In To ASP For File Access
      Does ASP only use the IUSR_<IIS Machine Name> to gain access to files located on a LAN, or can another user account name and password be setup? ...
    5. Role empty in WindowsPrincipal
      Hello. I have a test system with one Win2003 server as a domain controller and one WinXP client. The domain has been setup and the WinXP client...
  3. #2

    Default Re: Why won't WindowsPrincipal show as IUSR_<machine> ?

    Good question. Remind me again which user is showing properties? I've
    never used mode="None" before so I don't know how that is supposed to
    behave.

    Joe K.

    "Odie" <Odie@discussions.microsoft.com> wrote in message
    news:6CE029C1-5BB3-4FD4-BC56-F3B4AC119DBA@microsoft.com...
    > Okay... but why is IsAuthenticated=True and IsAnonymous=False even though
    I have authentication mode="none" ?
    >
    >
    > "Joe Kaplan (MVP - ADSI)" wrote:
    >
    > > It will be IUSER_MACHINE if you leave anonymous turned on in IIS AND
    enable
    > > impersonation in your web.config.
    > >
    > > Joe K.
    > >
    > > "Odie" <Odie@discussions.microsoft.com> wrote in message
    > > news:0256388A-CFC3-4929-9D88-4AA8B0CE72BD@microsoft.com...
    > > > I have a test harness set up to explore some .Net security stuff.
    > > > I have an .aspx page w/ .cs code-behind that gets the current Windows
    > > identity of the asp.net thread:
    > > > -=-=
    > > > WindowsIdentity MyIdentity = WindowsIdentity.GetCurrent();
    > > > WindowsPrincipal MyPrincipal = new WindowsPrincipal(MyIdentity);
    > > > string Name = MyPrincipal.Identity.Name;
    > > > string Type = MyPrincipal.Identity.AuthenticationType;
    > > > string Auth = MyPrincipal.Identity.IsAuthenticated.ToString();
    > > > //Identity values.
    > > > string IdentName = MyIdentity.Name;
    > > > string IdentType = MyIdentity.AuthenticationType;
    > > > string IdentIsAuth = MyIdentity.IsAuthenticated.ToString();
    > > > string ISAnon = MyIdentity.IsAnonymous.ToString();
    > > > -=-=
    > > >
    > > > When I have IIS Security set to [anon + integrated security], my test
    page
    > > printed out:
    > > > Principal Name: MYMACHINE\ASPNET
    > > > Principal Type: NTLM
    > > > Principal IsAuthenticated: True
    > > > Identity IsAnonymous: False
    > > > Identity IsGuest: False
    > > > Identity IsSystem: False
    > > >
    > > > This is good.
    > > > But when I removed integrated security from IIS Security tab my test
    page
    > > still prints out exactly the same thing! Then I remembered asp.net has
    it's
    > > own stuff in web.config, so I changed:
    > > > <authentication mode="Windows" />
    > > > to
    > > > <authentication mode="None" />
    > > >
    > > > I still get exactly the same output from my test page! Just in case
    > > there's some weird caching going on here, I shut down my web server and
    ran
    > > IISRESET - still to no avail.
    > > >
    > > > I can sort of understand the PrincipalName=ASPNET (even though I would
    > > expect it to be IUSR_MYMACHINE). But I don't understand why it insists
    on
    > > having IsAuthenticated=True and IsAnonymous=False.
    > > >
    > > > ??
    > > >
    > >
    > >
    > >

    Joe Kaplan \(MVP - ADSI\) Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139