Fixes: #U4-1077, found an bug with both our code and Microsoft's code in that if you RemapPath with an incorrect URL which contains

2 '?' the internals of ASP.net actually force a secondary internal request which causes BeginRequest to fire but doesn't follow the normal
chain of the module. It was a bug with our code having two query strings, however its pretty strange behavior on their part!
Have removed UmbracoContext.ClientUrl since it is not necessary to have. Have renamed UmbracoContext.UmbracoUrl = CleanedUmbracoUrl and UmbracoContext.RequextUrl = OriginalRequestUrl
Have moved the route processing logic to a static method on PublishedContentRequest which auto assigns the request back to the UmbracoContext, plus this is a cleaner
way to do the processing, including allowing us to unit test this one aspect.
Lastly, we are now rewriting the path back to the original URL in the RenderRouteHandler so that in MVC controllers the HttpContext.Request actually
reflects the URL that the client requested, not the rewritten URL (we do this in webforms too)
This commit is contained in:
Shannon Deminick
2012-10-26 02:55:57 +05:00
parent e3f9375fd2
commit 07f8f79620
19 changed files with 218 additions and 143 deletions

View File

@@ -1,17 +1,47 @@
using System;
using System.Configuration;
using System.IO;
using System.Threading;
using System.Xml;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Tests.TestHelpers;
using Umbraco.Web;
using Umbraco.Web.Routing;
using umbraco.BusinessLogic;
using umbraco.IO;
using umbraco.cms.businesslogic.cache;
using umbraco.cms.businesslogic.template;
namespace Umbraco.Tests.Routing
{
[TestFixture, RequiresSTA]
public class PublishedContentRequestBuilderTests : BaseRoutingTest
{
//[Test]
//public void Alt_Template()
//{
// var template = Template.MakeNew("test", new User(0));
// var altTemplate = Template.MakeNew("alt", new User(0));
// var umbracoContext = GetUmbracoContext("/home?altTemplate=" + altTemplate.Alias, template.Id);
// // create the new document request since we're rendering a document on the front-end
// var docreq = PublishedContentRequest.CreateForFrontEndRequest(umbracoContext);
// //create the searcher
// var searcher = new PublishedContentRequestBuilder(docreq);
// //find domain
// searcher.LookupDomain();
// // redirect if it has been flagged
// Assert.IsFalse(docreq.IsRedirect);
// //find the document, found will be true if the doc request has found BOTH a node and a template
// var found = searcher.LookupDocument();
//}
}
[TestFixture, RequiresSTA]
public class UmbracoModuleTests : BaseRoutingTest
{