Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Querying the current user's identity using WindowsIdentity?

I'm using WindowsIdentity to get the current user's ID to do SSO. For the most part, I'm getting exactly what I want, but for some users I'm getting odd results. Example code:

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

Sometimes I get [email protected] and I'm then able to sign in. Other times I get [email protected]/[email protected].

Is there a place where I can see the current identity using Windows 7? Like in Control Panel or something?

Thanks!

like image 608
Duy Avatar asked Nov 13 '22 02:11

Duy


1 Answers

Then you can change your code to split the values on /

try

WindowsIdentity MyIdentity = WindowsIdentity.GetCurrent();
like image 176
JohnnBlade Avatar answered Dec 30 '22 20:12

JohnnBlade