Adding UrlHelper to UmbracoUserControl

This commit is contained in:
Morten Christensen
2013-01-04 11:03:54 -01:00
parent ad36595b96
commit d5554308d3

View File

@@ -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;
/// <summary>
/// Returns a UrlHelper
/// </summary>
/// <remarks>
/// This URL helper is created without any route data and an empty request context
/// </remarks>
public UrlHelper Url
{
get { return _url ?? (_url = new UrlHelper(new RequestContext(new HttpContextWrapper(Context), new RouteData()))); }
}
}
}