#18639: Fixing layers not taking UrlPrefix into account

Work Item: 18639
This commit is contained in:
Sebastien Ros
2012-07-09 10:38:53 -07:00
parent cc5477eee2
commit bd20fecd47

View File

@@ -1,13 +1,17 @@
using System;
using System.Web;
using Orchard.Environment.Configuration;
using Orchard.Mvc;
using Orchard.Widgets.Services;
namespace Orchard.Widgets.RuleEngine {
public class UrlRuleProvider : IRuleProvider {
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly ShellSettings _shellSettings;
public UrlRuleProvider(IHttpContextAccessor httpContextAccessor) {
public UrlRuleProvider(IHttpContextAccessor httpContextAccessor, ShellSettings shellSettings) {
_httpContextAccessor = httpContextAccessor;
_shellSettings = shellSettings;
}
public void Process(RuleContext ruleContext) {
@@ -21,7 +25,11 @@ namespace Orchard.Widgets.RuleEngine {
var appPath = context.Request.ApplicationPath;
if (appPath == "/")
appPath = "";
url = string.Format("{0}/{1}", appPath, url);
if(!String.IsNullOrEmpty(_shellSettings.RequestUrlPrefix))
appPath = String.Concat(appPath, "/", _shellSettings.RequestUrlPrefix);
url = String.Concat(appPath, "/", url);
}
if (!url.Contains("?"))