ASP .NET How to Get Logged In User Name?

  • Thread starter Thread starter PuraniJeanz
  • Start date Start date
P

PuraniJeanz

Guest
To get the Logged In User Name in asp.net's codebehind file what steps should be taken?

ie when the request from the client is passed to the server, the called page should be able to identify the logged on user's NT credentials on the machine from which the call came from...


I have turned off Anonymous Access in IIS and checked Integrated Windows Authentication option there.


I have in my web.config:
<identity impersonate="true"/>
<authentication mode="Windows" />

I tried this:

Response.Write(System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString());


When i access the application through browser, it asks me for windows username/password. If i enter correct username/password, it shows me DomainName\UserName on the page which is correct but i dont want the login dialog to popup.

What am I doing wrong? Appreciate any help on this.

Zain.
 
Back
Top