public static Uri ResolveUrl(string urlToBeResolved) { if (!string.IsNullOrEmpty(urlToBeResolved)) { // Embedded image URL if (urlToBeResolved.StartsWith("/", StringComparison.Ordinal) && urlToBeResolved.Contains(";component/")) { return(new Uri(urlToBeResolved, UriKind.Relative)); } if (urlToBeResolved.StartsWith("http://", StringComparison.OrdinalIgnoreCase) || urlToBeResolved.StartsWith("https://", StringComparison.OrdinalIgnoreCase)) { return(new Uri(urlToBeResolved, UriKind.Absolute)); } string resolvedUrl = urlToBeResolved; if (resolver != null) { resolvedUrl = resolver.ResolveUrl(urlToBeResolved); } Uri imageUri; if (Uri.TryCreate(resolvedUrl, UriKind.RelativeOrAbsolute, out imageUri)) { return(imageUri); } } return(null); }
public object Resolve(object source, object destination, string sourceMember, object destMember, ResolutionContext context) { dynamic model = new ExpandoObject(); model.Url = _urlResolver.ResolveUrl("ChangePassword", "Auth", new { token = sourceMember }); return(model); }
public ResourcesDependencyLoader(IUrlResolver urlResolver) { AddPath("UCommerce", urlResolver.ResolveUrl("")); AddPath("shell", urlResolver.ResolveUrl("")); }