Page.User.Identity.Name vs. WindowsIdentity.GetCurrent().Name

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

  1. #1

    Default Page.User.Identity.Name vs. WindowsIdentity.GetCurrent().Name

    What is the difference between
    Page.User.Identity.Name
    and
    WindowsIdentity.GetCurrent().Name

    In what scenarios would I use one or the other?
    Shary Guest

  2. Similar Questions and Discussions

    1. Access Denied on WindowsIdentity.GetCurrent()
      Hi, I am developing an ASP.NET Application in C#. I need to find out the user under which the process is running on runtime. So I use...
    2. Access is denied in WindowsIdentity.GetCurrent
      I am suddenly getting this on a couple of Windows XP (.NET 1.1) machines in my environment. The machines haven't change, and my code hasn't...
    3. *** User.Identity.Name
      After a user logging on, User.Identity.Name contains domain/logon name of the current user. How to get other information of the current user such as...
    4. User.Identity.Name
      Hi, I am using Forms authentication -in which - I am trying to use User.Identity.Name, i am getting the user name in this field even after i...
    5. Old ASP Windows User Identity
      Is there a way in ASP (3.0, not .NET) for me to determine who the current windows users is (i.e. the user who was authenticated and who is...
  3. #2

    Default Re: Page.User.Identity.Name vs. WindowsIdentity.GetCurrent().Name

    Hi Shary

    Page.User.Identity.Name can also return the name of a user logged in with
    FormsAuthentication or Passport.

    --
    Daniel Fisher(lennybacon)
    MCP ASP.NET C#
    Blog: [url]http://www.lennybacon.com/[/url]


    "Shary" <junglesnake@gmail.com> wrote in message
    news:99ef4d4.0412111239.322eb802@posting.google.co m...
    > What is the difference between
    > Page.User.Identity.Name
    > and
    > WindowsIdentity.GetCurrent().Name
    >
    > In what scenarios would I use one or the other?

    Daniel Fisher\(lennybacon\) Guest

  4. #3

    Default Re: Page.User.Identity.Name vs. WindowsIdentity.GetCurrent().Name

    Page.User.Identity.Name will be the name of the user who authenticated with
    the site, assuming they used one of the supported authentication mechanisms
    (Windows, Forms, Passport). Note that this use can be a Windows user
    (WindowsPrincipal/WindowsIdentity), but it could also be any other
    IPrincipal as well.

    WindowsIdentity.GetCurrent().Name is the WindowsIdentity that the current
    thread is executing under. It controls what security context is used by
    unmanaged code, such as accessing files, SQL or AD. It will either be the
    process account or an impersonated account.

    The two will be the same thing if you are using impersonation with ASP.NET
    and are using Windows authentication. Otherwise, they can be different.

    HTH,

    Joe K.

    "Shary" <junglesnake@gmail.com> wrote in message
    news:99ef4d4.0412111239.322eb802@posting.google.co m...
    > What is the difference between
    > Page.User.Identity.Name
    > and
    > WindowsIdentity.GetCurrent().Name
    >
    > In what scenarios would I use one or the other?

    Joe Kaplan \(MVP - ADSI\) Guest

  5. #4

    Default Re: Page.User.Identity.Name vs. WindowsIdentity.GetCurrent().Name

    You might want to take a look at
    [url]http://msdn.microsoft.com/library/en-us/dnnetsec/html/SecNetAP05.asp[/url]. It
    contains descriptions of the principal and identity objects used by ASP.NET,
    as well as their expected values under various combinations of IIS and
    ASP.NET authentication schemes.

    HTH,
    Nicole


    "Shary" <junglesnake@gmail.com> wrote in message
    news:99ef4d4.0412111239.322eb802@posting.google.co m...
    > What is the difference between
    > Page.User.Identity.Name
    > and
    > WindowsIdentity.GetCurrent().Name
    >
    > In what scenarios would I use one or the other?

    Nicole Calinoiu 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