Is there any built-in utility or helper to parse HttpContext.Current.User.Identity.Name, e.g. domain\user to get separately domain name if exists and user?
Or is there any other class to do so?
I understand that it’s very easy to call String.Split('\') but just interesting
This is better (easier to use, no opportunity of
NullReferenceExcpetionand conforms MS coding guidelines about treating empty and null string equally):Usage:
This requires C# 3.0 compiler (or newer) and doesn’t require 3.0 .Net for working after compilation.