Query current user id using WindowsIdentity?

I use WindowsIdentity to get the current user ID for SSO. For the most part, I get exactly what I want, but for some users I get strange results. Code example:

IIdentity WinId = HttpContext.Current.User.Identity;
WindowsIdentity wi = (WindowsIdentity)WinId;
String idName = wi.Name.Replace(@"TESTHQ\", "");

Sometimes I get duy@test.org, and then I can come in. Other times I get jone @ test.org / broadcast @ test.org.

Is there a place where I can see the current authentication using Windows 7? Like in the control panel or something else?

Thank!

+5
source share
1 answer

Then you can change your code to split the values ​​by /

to try

WindowsIdentity MyIdentity = WindowsIdentity.GetCurrent();
+1
source

All Articles