Friday, 15 March 2013

c# - get current windows user in webapp -



c# - get current windows user in webapp -

i using string appnetworkuserid = windowsidentity.getcurrent().name; current user of web application. works when i'm running machine locally. domain\my name, when run app on dev server nt authority\network service instead of user accessing website.

how can user name of visitor webapp?

i'm using .net 4.0 , c#

you nt authority\network service because identity running iis. own name in development environment because web server there running logged-in user rather scheme user.

if utilize authentication framework 1 in asp.net mvc, can check

user.identity.name

in controller action.

c# .net-4.0 authorization windows-authentication

No comments:

Post a Comment