Пример #1
0
        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);
        }
Пример #2
0
        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(""));
 }