M
Mrinal
Hi ,
I am dealing with a strange issue , that , i initially thought would be a sitter to implement , let me know if you have some
clue to resolve the issue :
In one of my business logic , i fetch the current logged on user as follows :
string username = System.Security.Principal.WindowsIdentity.GetCurrent().Name ;
it fetches the username in the format : domain\username for e.g : st-users\mrinal
now , for my logic , i only need logged in user name viz : mrinal , now when i try removing the domain name portion with \
i.e i want to remove st-users\ , then neither regex nor char array has helped , as it's an escape sequence , so can't be
matched with a regex pattern . For converting to the char array it combines \ with next character when stored in an array
for e.g : here it stores \m , so , i can't get only username , that i need .
Any suggestions to implement this or may be easier option is if there's an API that can just give me logged in
username without domain name and \ .
Any help in this regard would be great .
thanks ,
Mrinal .
I am dealing with a strange issue , that , i initially thought would be a sitter to implement , let me know if you have some
clue to resolve the issue :
In one of my business logic , i fetch the current logged on user as follows :
string username = System.Security.Principal.WindowsIdentity.GetCurrent().Name ;
it fetches the username in the format : domain\username for e.g : st-users\mrinal
now , for my logic , i only need logged in user name viz : mrinal , now when i try removing the domain name portion with \
i.e i want to remove st-users\ , then neither regex nor char array has helped , as it's an escape sequence , so can't be
matched with a regex pattern . For converting to the char array it combines \ with next character when stored in an array
for e.g : here it stores \m , so , i can't get only username , that i need .
Any suggestions to implement this or may be easier option is if there's an API that can just give me logged in
username without domain name and \ .
Any help in this regard would be great .
thanks ,
Mrinal .