Getting Local System's UserName in a web based project

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • NawazAhmed
    New Member
    • Feb 2008
    • 36

    Getting Local System's UserName in a web based project

    Hi,
    I was trying to get local system's username in my code behind. I tried every almost possible way.
    Here is the scenario:
    My project is web based and I don't have a login screen....I need to get the local system's username when some user opens the website....
    I tried.
    Code:
    environment.Username
    environ("username")
    System.Windows.Forms.SystemInformation.UserName
    system.Security.Principal.WindowsIdentity.GetCurrent.Name
    and some functions as well posted at this site: http://www.developerfusion.co.uk/show/4409/
    But no luck.....Its getting the username from the server instead of the user's computer.....
    And I am using VS 2008.
    I would really appriciate....I f someone can provide me a better solution for this..

    Thanks.
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    Well, if you are using integrated windows authentication in IIS, this will get the domain user name:
    Code:
    Page.User.Identity.Name
    But if you allow Anonymous access, you might just get the IUSR_<machinena me> account. I'm not sure what happens if you use Basic/Forms authentication.

    Comment

    • NawazAhmed
      New Member
      • Feb 2008
      • 36

      #3
      How can I turn on windows authentication in vista ultimate?

      I found this it was under programs and turn windows features on or off..

      Comment

      • Curtis Rutland
        Recognized Expert Specialist
        • Apr 2008
        • 3264

        #4
        I'm not sure of your whole setup. Windows authentication works against a domain.

        You need to understand more about IIS authentication. Look that up. Vista uses IIS 7.

        Comment

        • NawazAhmed
          New Member
          • Feb 2008
          • 36

          #5
          Hey I turned on the windows authentication and ran the same thing again...
          but I am not getting any username....
          Any guesses...what could b the problem???

          Comment

          • Curtis Rutland
            Recognized Expert Specialist
            • Apr 2008
            • 3264

            #6
            Like I said, Windows authentication works against a domain. You aren't going to be able to get just anyone's local username, because you don't have access to it through the web. You need to either set up a domain, or use basic authentication. But basic authentication still refers to accounts on the server, not the client.

            Comment

            • NawazAhmed
              New Member
              • Feb 2008
              • 36

              #7
              I atlast got this one working........ ..
              I went to server and turned on windows authentication in IIS and turned off the asyncronous option.......an d thats all I need to do to get the clients username and no doubt client should be in the same domain.

              Thanks for the help guyz.

              Comment

              Working...