user info

Discussion in 'ASP .Net' started by =?Utf-8?B?TGFtaXM=?=, Sep 3, 2007.

  1. WindowsPrincipal p = System.Threading.Thread.CurrentPrincipal as
    System.Security.Principal.WindowsPrincipal;

    p.Identity.Name tells me userId. how do I get out not only the log in name
    but also the name of the person who is inlogged in the system???


    --
    LZ
     
    =?Utf-8?B?TGFtaXM=?=, Sep 3, 2007
    #1
    1. Advertising

  2. To best my knowledge would only return an initialized
    WindowsPrinicipal if somewhere program had assigned this previously,
    otherwise this would just be a blank GenericPrincipal.

    If the quoted line of code is working, it appears to me that some
    piece of code had previously 'constructed' an object of
    WindowsPrincipal by itself and then assigned it as thread's principal.

    To get WindowsPrinicipal of current OS logged-in user you may do
    following

    WindowsPrincipal p = new
    WindowsPrincipal(WindowsIdentity.GetCurrent());
     
    Muhammad Naveed Yaseen, Sep 3, 2007
    #2
    1. Advertising

  3. To best my knowledge Thread.CurrentPrincipal would only return an
    initialized WindowsPrinicipal if somewhere program had assigned this
    previously, otherwise this would just be a blank GenericPrincipal.

    If the quoted line of code is working, it appears to me that some
    piece of code had previously 'constructed' an object of
    WindowsPrincipal by itself and then assigned it as thread's
    principal.


    To get WindowsPrinicipal of current OS logged-in user you may do
    following


    WindowsPrincipal p = new
    WindowsPrincipal(WindowsIdentity.GetCurrent());
     
    Muhammad Naveed Yaseen, Sep 3, 2007
    #3
  4. Hi,

    Sorry but I still don't get it. How would I be able to get out full name
    (user full name) out of the windowsPrincipal p object???
    --
    LZ


    "Muhammad Naveed Yaseen" wrote:

    > To best my knowledge Thread.CurrentPrincipal would only return an
    > initialized WindowsPrinicipal if somewhere program had assigned this
    > previously, otherwise this would just be a blank GenericPrincipal.
    >
    > If the quoted line of code is working, it appears to me that some
    > piece of code had previously 'constructed' an object of
    > WindowsPrincipal by itself and then assigned it as thread's
    > principal.
    >
    >
    > To get WindowsPrinicipal of current OS logged-in user you may do
    > following
    >
    >
    > WindowsPrincipal p = new
    > WindowsPrincipal(WindowsIdentity.GetCurrent());
    >
    >
    >
     
    =?Utf-8?B?TGFtaXM=?=, Sep 4, 2007
    #4
    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. Vasanth
    Replies:
    0
    Views:
    599
    Vasanth
    Jun 28, 2004
  2. Andrea Williams

    Clear the Render info & change to different info

    Andrea Williams, Oct 27, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    1,456
    Ken Dopierala Jr.
    Oct 27, 2004
  3. Kiran
    Replies:
    0
    Views:
    1,255
    Kiran
    Feb 6, 2005
  4. ilya

    get CPU info, RAM info

    ilya, Apr 8, 2010, in forum: Java
    Replies:
    43
    Views:
    6,254
    Mike Schilling
    Apr 19, 2010
  5. Kenshin
    Replies:
    1
    Views:
    243
    Jeff Cochran
    Jun 25, 2004
Loading...

Share This Page