Esempio n. 1
0
        public static IISRewriteMapCollection Parse(XElement xmlRoot)
        {
            if (xmlRoot == null)
            {
                throw new ArgumentNullException(nameof(xmlRoot));
            }

            var mapsElement = xmlRoot.Descendants(RewriteTags.RewriteMaps).SingleOrDefault();

            if (mapsElement == null)
            {
                return(null);
            }

            var rewriteMaps = new IISRewriteMapCollection();

            foreach (var mapElement in mapsElement.Elements(RewriteTags.RewriteMap))
            {
                var map = new IISRewriteMap(mapElement.Attribute(RewriteTags.Name)?.Value);
                foreach (var addElement in mapElement.Elements(RewriteTags.Add))
                {
                    map[addElement.Attribute(RewriteTags.Key).Value.ToLowerInvariant()] = addElement.Attribute(RewriteTags.Value).Value;
                }
                rewriteMaps.Add(map);
            }

            return(rewriteMaps);
        }
Esempio n. 2
0
 public InputParser(IISRewriteMapCollection rewriteMaps)
 {
     _rewriteMaps = rewriteMaps;
 }
Esempio n. 3
0
 public InputParser(IISRewriteMapCollection rewriteMaps, bool alwaysUseManagedServerVariables)
 {
     _rewriteMaps = rewriteMaps;
     _alwaysUseManagedServerVariables = alwaysUseManagedServerVariables;
 }