protected void btnRemoveRedundantPaths_Click(object sender, EventArgs e) { var mappings = LegacyUrlHandlerFacade.GetMappingsFromXml().RawLinks; var siteMap = LegacyUrlHandlerFacade.GetMappingsFromSiteMap(); foreach (var m in siteMap) { var oldPath = m.Key; if (mappings.ContainsKey(oldPath)) { mappings.Remove(oldPath); } } LegacyUrlHandlerFacade.WriteXml(mappings); btnRemoveRedundantPaths.Visible = false; lblResult.Text = "Redundant paths are removed."; }
protected void btnStoreCurrentPaths_Click(object sender, EventArgs e) { var mappings = LegacyUrlHandlerFacade.GetMappingsFromXml().RawLinks; var siteMap = LegacyUrlHandlerFacade.GetMappingsFromSiteMap(); foreach (var m in siteMap) { var pageId = m.Value; var oldPath = m.Key; var newPath = string.Format("~/page({0})", pageId); if (!mappings.ContainsKey(oldPath)) { mappings.Add(oldPath, newPath); } } LegacyUrlHandlerFacade.WriteXml(mappings); btnStoreCurrentPaths.Visible = false; lblResult.Text = "Current paths are stored. Please make required changes to website and press 'Remove Redundant Paths' url above."; }