diff --git a/src/Umbraco.Web/Mvc/UmbracoVirtualNodeByUdiRouteHandler.cs b/src/Umbraco.Web/Mvc/UmbracoVirtualNodeByUdiRouteHandler.cs new file mode 100644 index 000000000000..a1ee6c732a67 --- /dev/null +++ b/src/Umbraco.Web/Mvc/UmbracoVirtualNodeByUdiRouteHandler.cs @@ -0,0 +1,27 @@ +using System.Web.Routing; +using Umbraco.Core; +using Umbraco.Core.Models.PublishedContent; + +namespace Umbraco.Web.Mvc +{ + public class UmbracoVirtualNodeByUdiRouteHandler : UmbracoVirtualNodeRouteHandler + { + private readonly Udi _realNodeUdi; + + public UmbracoVirtualNodeByUdiRouteHandler(GuidUdi realNodeUdi) + { + _realNodeUdi = realNodeUdi; + } + + protected sealed override IPublishedContent FindContent(RequestContext requestContext, UmbracoContext umbracoContext) + { + var byId = umbracoContext.Content.GetById(_realNodeUdi); + return byId == null ? null : FindContent(requestContext, umbracoContext, byId); + } + + protected virtual IPublishedContent FindContent(RequestContext requestContext, UmbracoContext umbracoContext, IPublishedContent baseContent) + { + return baseContent; + } + } +} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index e04adc9e84f1..9de612934484 100755 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -250,6 +250,7 @@ +