From d5554308d3d4dd78a05623a6ef833237dc122979 Mon Sep 17 00:00:00 2001 From: Morten Christensen Date: Fri, 4 Jan 2013 11:03:54 -0100 Subject: [PATCH] Adding UrlHelper to UmbracoUserControl --- src/Umbraco.Web/UmbracoUserControl.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Umbraco.Web/UmbracoUserControl.cs b/src/Umbraco.Web/UmbracoUserControl.cs index e9f3444483..ac0a0dd60f 100644 --- a/src/Umbraco.Web/UmbracoUserControl.cs +++ b/src/Umbraco.Web/UmbracoUserControl.cs @@ -1,4 +1,7 @@ using System; +using System.Web; +using System.Web.Mvc; +using System.Web.Routing; using System.Web.UI; using Umbraco.Core; using Umbraco.Core.Services; @@ -68,5 +71,17 @@ namespace Umbraco.Web { get { return ApplicationContext.DatabaseContext; } } + + private UrlHelper _url; + /// + /// Returns a UrlHelper + /// + /// + /// This URL helper is created without any route data and an empty request context + /// + public UrlHelper Url + { + get { return _url ?? (_url = new UrlHelper(new RequestContext(new HttpContextWrapper(Context), new RouteData()))); } + } } } \ No newline at end of file