Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. display user name

display user name

Scheduled Pinned Locked Moved ASP.NET
help
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    HowRU
    wrote on last edited by
    #1

    HI, Help me for a very simple thing.. I want to display the name of the windows loggin user on the right top of my web page...that means when ever the user run my application his/her name should be displayed on that page....like "welcome abc" Please help me... Thanks

    A S 2 Replies Last reply
    0
    • H HowRU

      HI, Help me for a very simple thing.. I want to display the name of the windows loggin user on the right top of my web page...that means when ever the user run my application his/her name should be displayed on that page....like "welcome abc" Please help me... Thanks

      A Offline
      A Offline
      Aryadip
      wrote on last edited by
      #2

      Hi, You can use "this.User.Identity.Name" to get the name of the Windows User making the request for the page. This will return the username as [Domain or Machine name]\UserName If you now want to remove the domain or machine name then you need to do some string manipulation. Note : This property won't work when you are running the site with authentication mode as anonymous. regards, Aryadip. Cheers !! and have a Funky day !!

      H 1 Reply Last reply
      0
      • A Aryadip

        Hi, You can use "this.User.Identity.Name" to get the name of the Windows User making the request for the page. This will return the username as [Domain or Machine name]\UserName If you now want to remove the domain or machine name then you need to do some string manipulation. Note : This property won't work when you are running the site with authentication mode as anonymous. regards, Aryadip. Cheers !! and have a Funky day !!

        H Offline
        H Offline
        HowRU
        wrote on last edited by
        #3

        Hi Aryadip, I tryed to use your code in the following way but its giving me the blank output...why?...why not the windows user name.. lblUserName.Text=this.User.Identity.Name.ToString(); reply me thanks.

        A 1 Reply Last reply
        0
        • H HowRU

          Hi Aryadip, I tryed to use your code in the following way but its giving me the blank output...why?...why not the windows user name.. lblUserName.Text=this.User.Identity.Name.ToString(); reply me thanks.

          A Offline
          A Offline
          Aryadip
          wrote on last edited by
          #4

          hi, As I have told you earlier, the code won't work if you have given your site anonymous access. Your site needs authentication mode as "Windows Authentication". To Enable it... Open IIS console... Navigate to the Virtual folder of your application. Right click on the virtual folder and select "properties" Go to "Directory Security" Tab Click on "Edit" of "anonymous asccess and authentication control" section. You will get "Authentication Methods" window. The top most authentication method is " Anonymous" and the buttom most is "Windows Authentication". All you need to do is UNCHECK anonymous and CHECK "Windows Authentication" and restart your application.. I mean make a fresh request from a new instance of browser... I guess this time you will get it right... regards, Aryadip. Cheers !! and have a Funky day !!

          1 Reply Last reply
          0
          • H HowRU

            HI, Help me for a very simple thing.. I want to display the name of the windows loggin user on the right top of my web page...that means when ever the user run my application his/her name should be displayed on that page....like "welcome abc" Please help me... Thanks

            S Offline
            S Offline
            Spanky3
            wrote on last edited by
            #5

            Firstly what are u using for persistence ie: how do you remember your users? Cookies? DB? XML ?

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups