We all know that User.Identity.Name gets to the machine name and the user name of the logged in user. The structure that it returns the username is something like this:
MACHINE NAME\USER NAME
Sometimes we need to separate the UserName with the Machine name.
Here is a easy code that can perform this:
string userName = User.Identity.Name;
string user = System.IO.Path.GetFileName(userName);
Response.Write(user);
No comments:
Post a Comment