private string GetUserConfigPath()
{
try
{
return ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal).FilePath;
}
catch (ConfigurationErrorsException ex)
{
// If the user.config file is corrupt then it will throw a ConfigurationErrorsException
// Fortunately we can still gets it path from the exception.
return ex.Filename;
}
}