开发者

Upper case from System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString()?

I hope this isn't oo trivial question, but when I call System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString() I'm getting back a lower case user ID, but other dev's are getting an upper case user ID. How can I force ystem.Security.Principal.WindowsIdentity.GetCurrent().Name.开发者_运维百科ToString() to return an upper case string?


Try

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


UPDATE!! I still have not completely answered my question, but I have a clue. When System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString() is called from my ASP.Net app when running within IIS I get a User ID with all caps. When I call this line from my asp.net app from within the vs.net web server my ID is in lower case.

Thanks for the response with the ToUpper() code, but I checked the production code and thatis not used.


Add .ToUpper() after .ToString()


When a user logs on to windows, he can type his name using any case: maurice, Maurice, MaUrIcE and MAURICE are all acceptable.

It is the name as he typed it that WindowsIdentity.GetCurrent().Name() returns. You can confirm this by typing your userid with unusual case and locking the workstation; the name displayed will reflect what you typed and not your userid as it was created.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜