public string GetRewriteUrl(string url) { string text = null; if (url == null) { throw new ArgumentNullException("url"); } url = url.Trim().Replace('\\', '/'); if (EacFlightProvider.eacRewriteToSectionMap.ContainsKey(url)) { VariantConfigurationSnapshot snapshotForCurrentUser = EacFlightUtility.GetSnapshotForCurrentUser(); IUrlMapping @object = snapshotForCurrentUser.Eac.GetObject <IUrlMapping>(EacFlightProvider.eacRewriteToSectionMap[url]); text = @object.RemapTo; if (text != null) { text = text.Trim(); } if (text == string.Empty) { text = null; } } return(text); }
public RedirectModule(IUrlMapping urlMapping) { Get["/{Id}"] = parameters => { var id = parameters.Id; var url = urlMapping.Url_for_id(id); if (id != url) { return new RedirectResponse(url); } return string.Format("Id '{0}' is not defined", id); }; }