diff --git a/src/Orchard.Specs/Bindings/WebAppHosting.cs b/src/Orchard.Specs/Bindings/WebAppHosting.cs index a2c6d09e2..c14f78a36 100644 --- a/src/Orchard.Specs/Bindings/WebAppHosting.cs +++ b/src/Orchard.Specs/Bindings/WebAppHosting.cs @@ -337,7 +337,7 @@ namespace Orchard.Specs.Bindings { public void WhenIAmRedirected() { var urlPath = ""; if (Details.ResponseHeaders.TryGetValue("Location", out urlPath)) { - WhenIGoTo(urlPath.Replace("http://127.0.0.1/", "")); + WhenIGoTo(urlPath); } else { Assert.Fail("Expected to be redirected but no Location header returned"); diff --git a/src/Orchard.Specs/Hosting/RequestExtensions.cs b/src/Orchard.Specs/Hosting/RequestExtensions.cs index 1745ae0aa..9ed3b59fa 100644 --- a/src/Orchard.Specs/Hosting/RequestExtensions.cs +++ b/src/Orchard.Specs/Hosting/RequestExtensions.cs @@ -31,7 +31,12 @@ namespace Orchard.Specs.Hosting { details.UrlPath = urlPath.Substring(0, queryIndex).Replace('\\', '/'); details.Query = urlPath.Substring(queryIndex + 1); } - details.Page = (isHomepage ? "" : physicalPath.Combine(details.UrlPath.TrimStart('/', '\\')).GetRelativePath(physicalPath).ToString()).Replace('\\','/'); + + var physicalFilePath = physicalPath.Combine(details.UrlPath.TrimStart('/', '\\')); + details.Page = (isHomepage ? "" : physicalFilePath.GetRelativePath(physicalPath).ToString()); + + if (!File.Exists(physicalFilePath)) + details.Page = details.Page.Replace('\\', '/'); if (!string.IsNullOrEmpty(webHost.Cookies)) { details.RequestHeaders.Add("Cookie", webHost.Cookies);