I have a web application which is set on forms and anonymous access. I have a default page on which I want to get the current windows logged in user, it's an ASP.Net application.
How can I do this?
I have a web application which is set on forms and anonymous access. I have a default page on which I want to get the current windows logged in user, it's an ASP.Net application.
How can I do this?
Hello you can try with this code
WindowsIdentity wi = WindowsIdentity.GetCurrent();
var result = wi.Name;
var anonymous = wi.IsAnonymous; //For ensure your authentification mode
You can use this code
System.Web.HttpContext.Current.User.Identity.Name
But you must ensure that yo have added your principal in your thread in your security package, maybe httpmodule. (If you have custom authentification and Authorization)