title: Sharepoint retrieving username without domain or programmatically removing domain
body: <p>I'm returning the username from sharepoint site as a string. This is done successfully with the below code but I also get the domain with it. How can I only return the username and not the domain either through sharepoint or programmatically removing it? domain/username</p>
  
  <pre><code> private string CurrentUserName()
      {
          string userName = "NA";
          SPContext currentContext;
          try
          {
              //Getting the current context
              currentContext = SPContext.Current;
          }
          catch (InvalidOperationException)
          {
              currentContext = null;
          }
          if (currentContext != null &amp;&amp; currentContext.Web.CurrentUser != null)
          {
              userName = SPContext.Current.Web.CurrentUser.LoginName;
          }
          else
          {
  
          }
          return userName;
      }
  </code></pre>