Change port of urls in multi tenant admin

--HG--
branch : dev
This commit is contained in:
Sebastien Ros
2010-05-11 16:50:25 -07:00
parent 5cd0c2b519
commit 372010684d

View File

@@ -4,11 +4,17 @@ using Orchard.Environment.Configuration;
namespace Orchard.MultiTenancy.Extensions { namespace Orchard.MultiTenancy.Extensions {
public static class UrlHelperExtensions { public static class UrlHelperExtensions {
public static string Tenant(this UrlHelper urlHelper, ShellSettings tenantShellSettings) { public static string Tenant(this UrlHelper urlHelper, ShellSettings tenantShellSettings) {
return string.Format( //info: (heskew) might not keep the port insertion around beyond...
"http://{0}/{1}", var port = string.Empty;
!string.IsNullOrEmpty(tenantShellSettings.RequestUrlHost) string host = urlHelper.RequestContext.HttpContext.Request.Headers["Host"];
? tenantShellSettings.RequestUrlHost
: urlHelper.RequestContext.HttpContext.Request.Headers["Host"], if(host.Contains(":"))
port = host.Substring(host.IndexOf(":"));
return string.Format(
"http://{0}/{1}",
!string.IsNullOrEmpty(tenantShellSettings.RequestUrlHost)
? tenantShellSettings.RequestUrlHost + port : host,
tenantShellSettings.RequestUrlPrefix); tenantShellSettings.RequestUrlPrefix);
} }
} }