سؤال

I am building a web application for my school's intranet. Whenever teachers try to access the browser to access the intranet page a popup appears so they can login, in my page I need to get the logged username. do any of you guys know how to do that?

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

The code above is what I've managed to do so far which gets the username of the user loggin in on windows but that's not really what I want.

هل كانت مفيدة؟

المحلول

you can use simply the following statement :

HttpContext.Current.User.Identity.Name
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top