private void ScanLocationSection(XmlUtil xmlUtil) {
string locationSubPath = null;
bool allowOverride = true;
bool inheritInChildApp = true;
int errorCountBeforeScan = xmlUtil.SchemaErrors.GlobalErrorCount;
// Get the location section attributes
while (xmlUtil.Reader.MoveToNextAttribute()) {
switch (xmlUtil.Reader.Name) {
case KEYWORD_LOCATION_PATH:
locationSubPath = xmlUtil.Reader.Value;
break;
case KEYWORD_LOCATION_ALLOWOVERRIDE:
xmlUtil.VerifyAndGetBooleanAttribute(
ExceptionAction.Global, true, out allowOverride);
break;
case KEYWORD_LOCATION_INHERITINCHILDAPPLICATIONS:
xmlUtil.VerifyAndGetBooleanAttribute(
ExceptionAction.Global, true, out inheritInChildApp);
break;
default:
xmlUtil.AddErrorUnrecognizedAttribute(ExceptionAction.Global);
break;
}
}
xmlUtil.Reader.MoveToElement(); // if on an attribute move back to the element
try {
locationSubPath = NormalizeLocationSubPath(locationSubPath, xmlUtil);
//
//
if (locationSubPath == null &&
!inheritInChildApp &&
Host.IsDefinitionAllowed(_configPath, ConfigurationAllowDefinition.MachineToWebRoot, ConfigurationAllowExeDefinition.MachineOnly)) {
throw new ConfigurationErrorsException(SR.GetString(SR.Location_invalid_inheritInChildApplications_in_machine_or_root_web_config), xmlUtil);
}
}
catch (ConfigurationErrorsException ce) {
xmlUtil.SchemaErrors.AddError(ce, ExceptionAction.Global);
}
// Skip over this location section if there are errors
if (xmlUtil.SchemaErrors.GlobalErrorCount > errorCountBeforeScan) {
xmlUtil.StrictSkipToNextElement(ExceptionAction.NonSpecific);
return;
}
// Scan elements of the location section if the path is the current path.
// We do not add <location path="." /> to the _locationSections list.
if (locationSubPath == null) {
ScanSectionsRecursive(xmlUtil, string.Empty, true, null, !allowOverride, !inheritInChildApp);
return;
}
// Skip over location sections for client config
if (!_flags[SupportsLocation]) {
xmlUtil.StrictSkipToNextElement(ExceptionAction.NonSpecific);
return;
}
AddLocation(locationSubPath);
ScanSectionsRecursive(xmlUtil, string.Empty, true, locationSubPath, !allowOverride, !inheritInChildApp);
}