diff --git a/src/Umbraco.Web/Routing/DomainAndUri.cs b/src/Umbraco.Web/Routing/DomainAndUri.cs
index d7c4349cd9..db7eecf5af 100644
--- a/src/Umbraco.Web/Routing/DomainAndUri.cs
+++ b/src/Umbraco.Web/Routing/DomainAndUri.cs
@@ -13,25 +13,25 @@ namespace Umbraco.Web.Routing
internal class DomainAndUri
{
///
- /// Initializes a new instance of the class with a Domain and a Uri.
+ /// Initializes a new instance of the class with a Domain and a uri scheme.
///
- /// The Domain.
- /// The Uri.
- public DomainAndUri(Domain domain, Uri uri)
+ /// The domain.
+ /// The uri scheme.
+ public DomainAndUri(Domain domain, string scheme)
{
Domain = domain;
- Uri = uri;
+ Uri = new Uri(UriUtility.TrimPathEndSlash(UriUtility.StartWithScheme(domain.Name, scheme)));
}
///
/// Gets or sets the Umbraco domain.
///
- public Domain Domain { get; internal set; }
+ public Domain Domain { get; private set; }
///
/// Gets or sets the normalized uri of the domain.
///
- public Uri Uri { get; internal set; }
+ public Uri Uri { get; private set; }
///
/// Gets a string that represents the instance.
diff --git a/src/Umbraco.Web/Routing/DomainHelper.cs b/src/Umbraco.Web/Routing/DomainHelper.cs
index 5f30294499..bf59cbe182 100644
--- a/src/Umbraco.Web/Routing/DomainHelper.cs
+++ b/src/Umbraco.Web/Routing/DomainHelper.cs
@@ -50,9 +50,8 @@ namespace Umbraco.Web.Routing
var domainsAndUris = domains
.Where(d => !d.IsWildcard)
.Select(SanitizeForBackwardCompatibility)
- .Select(d => new { Domain = d, UriString = UriUtility.EndPathWithSlash(UriUtility.StartWithScheme(d.Name, scheme)) })
- .OrderByDescending(t => t.UriString)
- .Select(t => new DomainAndUri(t.Domain, new Uri(t.UriString)))
+ .Select(d => new DomainAndUri(d, scheme))
+ .OrderByDescending(d => d.Uri.ToString())
.ToArray();
if (!domainsAndUris.Any())
@@ -70,7 +69,7 @@ namespace Umbraco.Web.Routing
// assume only one can match the hint (is that OK?)
var hintWithSlash = current.EndPathWithSlash();
domainAndUri = domainsAndUris
- .FirstOrDefault(t => t.Uri.IsBaseOf(hintWithSlash));
+ .FirstOrDefault(d => d.Uri.EndPathWithSlash().IsBaseOf(hintWithSlash));
// if none matches, then try to run the filter to sort them out
if (domainAndUri == null && filter != null)
{
@@ -82,8 +81,6 @@ namespace Umbraco.Web.Routing
}
}
- if (domainAndUri != null)
- domainAndUri.Uri = domainAndUri.Uri.TrimPathEndSlash();
return domainAndUri;
}
@@ -99,9 +96,8 @@ namespace Umbraco.Web.Routing
var domainsAndUris = domains
.Where(d => !d.IsWildcard)
.Select(SanitizeForBackwardCompatibility)
- .Select(d => new { Domain = d, UriString = UriUtility.TrimPathEndSlash(UriUtility.StartWithScheme(d.Name, scheme)) })
- .OrderByDescending(t => t.UriString)
- .Select(t => new DomainAndUri(t.Domain, new Uri(t.UriString)));
+ .Select(d => new DomainAndUri(d, scheme))
+ .OrderByDescending(d => d.Uri.ToString());
return domainsAndUris;
}
diff --git a/src/Umbraco.Web/UmbracoContext.cs b/src/Umbraco.Web/UmbracoContext.cs
index db2c233b5c..ea6ea718bf 100644
--- a/src/Umbraco.Web/UmbracoContext.cs
+++ b/src/Umbraco.Web/UmbracoContext.cs
@@ -84,7 +84,11 @@ namespace Umbraco.Web
var umbracoContext = new UmbracoContext(httpContext, applicationContext);
// create the nice urls provider
- var niceUrls = new NiceUrlProvider(PublishedContentStoreResolver.Current.PublishedContentStore, umbracoContext);
+ // there's one per request because there are some behavior parameters that can be changed
+ var urlProvider = new UrlProvider(
+ umbracoContext,
+ PublishedContentStoreResolver.Current.PublishedContentStore,
+ UrlProviderResolver.Current.Providers);
// create the RoutingContext, and assign
var routingContext = new RoutingContext(
@@ -92,7 +96,7 @@ namespace Umbraco.Web
ContentFinderResolver.Current.Finders,
ContentLastChanceFinderResolver.Current.Finder,
PublishedContentStoreResolver.Current.PublishedContentStore,
- niceUrls,
+ urlProvider,
RoutesCacheResolver.Current.RoutesCache);
//assign the routing context back