internal Configuration FindLocationConfiguration (string relativePath, Configuration defaultConfiguration)
{
Configuration parentConfig = defaultConfiguration;
if (!String.IsNullOrEmpty (LocationConfigPath)) {
Configuration parentFile = GetParentWithFile ();
if (parentFile != null) {
string parentRelativePath = system.Host.GetConfigPathFromLocationSubPath (configPath, relativePath);
parentConfig = parentFile.FindLocationConfiguration (parentRelativePath, defaultConfiguration);
}
}
string relConfigPath = configPath.Substring (1) + "/";
if (relativePath.StartsWith (relConfigPath, StringComparison.Ordinal))
relativePath = relativePath.Substring (relConfigPath.Length);
ConfigurationLocation loc = Locations.FindBest (relativePath);
if (loc == null)
return parentConfig;
loc.SetParentConfiguration (parentConfig);
return loc.OpenConfiguration ();
}