private static string GetApplicationIdentity()
{
// get user
string user = string.Empty;
try
{
user = WindowsIdentity.GetCurrent().Name;
}
catch (Exception e)
{
CoreEventSource.Log.LogVerbose(string.Format(CultureInfo.InvariantCulture, "GetApplicationIdentity: Failed to read user identity. Exception: {0}", e));
}
// get domain's directory
string domainDirecotry = string.Empty;
try
{
domainDirecotry = AppDomain.CurrentDomain.BaseDirectory;
}
catch (AppDomainUnloadedException e)
{
CoreEventSource.Log.LogVerbose(string.Format(CultureInfo.InvariantCulture, "GetApplicationIdentity: Failed to read the domain's base directory. Exception: {0}", e));
}
// get process name
string processName = string.Empty;
try
{
processName = Process.GetCurrentProcess().ProcessName;
}
catch (Exception e)
{
CoreEventSource.Log.LogVerbose(string.Format(CultureInfo.InvariantCulture, "GetApplicationIdentity: Failed to read the process name. Exception: {0}", e));
}
return string.Format(CultureInfo.InvariantCulture, "{0}@{1}{2}", user, domainDirecotry, processName);
}