none
Retrieve credentials of a logged in user visual studio 2008 RRS feed

  • Question

  • Hello,

    I work in a company where they asked me to create a site in VS 2008 C# that displays the username of the already Windows logged-in username. It means anyone who opens the link on the server has to see their own username(e.g. Welcome "username") since is already logged in her/his computer.

    When I tried to use  WindowsIdentity.GetCurrent() and some others but actually I retrieve information from the server that is wrong.

    I appreciated your help.

    Thanks,

    Daniel

    Wednesday, October 17, 2012 5:55 PM

Answers

  • If this is a web application, configure IIS for Windows Authentication.  Then the Windows username is stored in the AUTH_USER server variable coming from the HTTP request:

    Response.Write(Request.ServerVariables["AUTH_USER"]);

    But note that the correct forum for ASP.net questions is http://forums.asp.net.


    Jose R. MCP
    Code Samples

    Wednesday, October 17, 2012 7:54 PM