I have a piece of code that retrieves the network user name, the code looks from the domain name to the user name, before it just gets the user name.
recently we went through a rename of our domain name, and I had to change the hard coded domain name in several projects.
I would like to know how to modify the code to avoid this situation in the future.
This is the code I have been using:
m_CurrentUser = HttpContext.Current.User.Identity.Name.ToString();
m_CurrentUser = m_CurrentUser.ToUpper().Replace("\\", "").Replace("CompanyDomain", "").ToLower();