public string ResolveHelpUrl(HelpPage requestedHelpPage) { HelpConfigPage bestMatchingConfigPage = null; int currentBestMatchCount = 0; foreach (HelpConfigPage helpConfigPage in HelpConfigPages) { int attributeMatchCount = 0; if ((helpConfigPage.Application != "" && String.Compare(helpConfigPage.Application, requestedHelpPage.Application, true) != 0) || (helpConfigPage.ApplicationUrl != "" && String.Compare(helpConfigPage.ApplicationUrl, requestedHelpPage.ApplicationUrl, true) != 0) || (helpConfigPage.Language != "" && String.Compare(helpConfigPage.Language, requestedHelpPage.Language, true) != 0) || (helpConfigPage.UserType != "" && String.Compare(helpConfigPage.UserType, requestedHelpPage.UserType, true) != 0)) { continue; } if (String.Compare(helpConfigPage.Application, requestedHelpPage.Application, true) == 0) attributeMatchCount++; if (String.Compare(helpConfigPage.ApplicationUrl, requestedHelpPage.ApplicationUrl, true) == 0) attributeMatchCount++; if (String.Compare(helpConfigPage.Language, requestedHelpPage.Language, true) == 0) attributeMatchCount++; if (String.Compare(helpConfigPage.UserType, requestedHelpPage.UserType, true) == 0) attributeMatchCount++; if (attributeMatchCount > currentBestMatchCount) { currentBestMatchCount = attributeMatchCount; bestMatchingConfigPage = helpConfigPage; } } return bestMatchingConfigPage == null ? GenerateDefaultUrl(requestedHelpPage) : GenerateConfiguredUrl(bestMatchingConfigPage); }
protected void Page_Load(object sender, EventArgs e) { Help help = new Help(UmbracoSettings.HelpPages); HelpPage requestedHelpPage = new HelpPage { Application = Request.QueryString["Application"], ApplicationUrl = Request.QueryString["ApplicationUrl"], Language = Request.QueryString["Language"], UserType = Request.QueryString["UserType"] }; Response.Redirect(help.ResolveHelpUrl(requestedHelpPage)); }
public string GenerateDefaultUrl(HelpPage helpPage) { return string.Format(DefaultURL, helpPage.Application, helpPage.ApplicationUrl); }
public string GenerateDefaultUrl(HelpPage helpPage) { return(string.Format(DefaultURL, helpPage.Application, helpPage.ApplicationUrl)); }