Professional Web Applications Themes

Get the current logged in user name - ASP.NET Security

Hello All, I am new to .net. I want to use windows authentication to authenticate against the current logged in user on the client machine. I believe by using windows authentication method, the IIS will send me details of the current logged in user at the client machine if integrated windows authentication is enabled at IIS. Can anyone please guide me how I can get the name of the current logged in client that is making a request to my ASP.net application ? I am trying to look into System.Web.Security class for this but have not been able to find ...

  1. #1

    Default Get the current logged in user name

    Hello All,
    I am new to .net. I want to use windows authentication to authenticate
    against the current logged in user on the client machine. I believe by using
    windows authentication method, the IIS will send me details of the current
    logged in user at the client machine if integrated windows authentication is
    enabled at IIS. Can anyone please guide me how I can get the name of the
    current logged in client that is making a request to my ASP.net application
    ?

    I am trying to look into System.Web.Security class for this but have not
    been able to find a piece of code or guidance of how to do it.

    Imran.


    Imran Guest

  2. #2

    Default Re: Get the current logged in user name

    See http://msdn.microsoft.com/library/en-us/dnnetsec/html/SecNetAP05.asp for
    a list of the three properties that expose user identity information that
    may be useful in your application, as well as descriptions of how various
    IIS and ASP.NET authentication and identity configurations affect the
    property values.



    "Imran Aziz" <net> wrote in message
    news:phx.gbl... 


    Nicole Guest

  3. #3

    Default Re: Get the current logged in user name

    User.Identity.Name

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen


     



    Brock Guest

  4. #4

    Default Re: Get the current logged in user name

    I cannot seem to find the container class for this property.

    It surly is not the member of System.Web.Security or am I wrong?

    Imran.

    "Brock Allen" <com> wrote in message
    news:microsoft.com... 
    >
    >
    >[/ref]


    Imran Guest

  5. #5

    Default Re: Get the current logged in user name

    This was in the context of a Control or the Page. Another way is to call:

    HttpContext.Current.User.Identity.Name

    -Brock
    DevelopMentor
    http://staff.develop.com/ballen


     [/ref][/ref]



    Brock Guest

  6. #6

    Default Re: Get the current logged in user name

    Brock thanks a lot for that, it does give me the login name along with the
    domain prefix.
    Thanks.

    "Brock Allen" <com> wrote in message
    news:microsoft.com... [/ref]
    >
    >
    >[/ref]


    Imran Guest

  7. #7

    Default Re: Get the current logged in user name

    "Imran Aziz" <net> wrote in message
    news:phx.gbl... 

    I used this in my ASP pages and still use it in ASP.NET although there's
    obviously many other was to achieve the same/similar result.

    Dim strWho as String
    strWho = Request.ServerVariables("AUTH_USER")
    or
    strWho = Request.ServerVariables("LOGON_USER")

    HTH,
    Jim


    Jim Guest

  8. #8

    Default Re: Get the current logged in user name

    Yeah it would give the Domain prefix like DOMAIN\Username.
    If you are authenticated in the domain.Whan you can do is to remove the
    Domain prefix if you don't need it.
    Patrick


    "Imran Aziz" <net> wrote in message
    news:phx.gbl... [/ref]
    call: 
    > >
    > >
    > >[/ref]
    >
    >[/ref]


    Pat Guest

  9. #9

    Default Re: Get the current logged in user name

    Thas true jim that will still do the trick in ASP.NET

    "Jim in Arizona" <com> wrote in message
    news:phx.gbl... [/ref]
    get 
    >
    > I used this in my ASP pages and still use it in ASP.NET although there's
    > obviously many other was to achieve the same/similar result.
    >
    > Dim strWho as String
    > strWho = Request.ServerVariables("AUTH_USER")
    > or
    > strWho = Request.ServerVariables("LOGON_USER")
    >
    > HTH,
    > Jim
    >
    >[/ref]


    Pat Guest

Similar Threads

  1. Replies: 4
    Last Post: August 17th, 10:45 PM
  2. Best way to remember a logged in user
    By Joshua Beall in forum PHP Development
    Replies: 16
    Last Post: December 31st, 03:21 AM
  3. Recognise a logged in user
    By KingWiggi in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: October 13th, 03:20 PM
  4. Logged in user?
    By Betina Y Andersen in forum ASP
    Replies: 7
    Last Post: September 22nd, 02:47 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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