diff --git a/src/Orchard/Mvc/Extensions/UrlHelperExtensions.cs b/src/Orchard/Mvc/Extensions/UrlHelperExtensions.cs index 57303be62..3189ba081 100644 --- a/src/Orchard/Mvc/Extensions/UrlHelperExtensions.cs +++ b/src/Orchard/Mvc/Extensions/UrlHelperExtensions.cs @@ -25,6 +25,10 @@ namespace Orchard.Mvc.Extensions { } public static string MakeAbsolute(this UrlHelper urlHelper, string url, string baseUrl = null) { + if(url.StartsWith("http", StringComparison.OrdinalIgnoreCase)) { + return url; + } + if(String.IsNullOrEmpty(baseUrl)) { baseUrl = urlHelper.RequestContext.HttpContext.Request.ToApplicationRootUrlString(); } @@ -34,14 +38,14 @@ namespace Orchard.Mvc.Extensions { } // remove any application path from the base url - var applicationPath = urlHelper.RequestContext.HttpContext.Request.ApplicationPath; + var applicationPath = urlHelper.RequestContext.HttpContext.Request.ApplicationPath ?? String.Empty; // orchardlocal/foo/bar => /orchardlocal/foo/bar if(!url.StartsWith("/")) { url = "/" + url; } // /orchardlocal/foo/bar => foo/bar - if (url.StartsWith(applicationPath)) { + if (url.StartsWith(applicationPath, StringComparison.OrdinalIgnoreCase)) { url = url.Substring(applicationPath.Length); }