views:

23

answers:

1

I have an ASP.Net web application running on an IIS server, and I need to find the visitors login username.

How can I can find this? When testing locally it found my username using new WindowsPrincipal(WindowsIdentity.GetCurrent());, but it finds NETWORK SERVICE when running the app on the server.

+1  A: 

I assume you use forms authentication. Try:

User.Identity.Name
zgorawski