Monday, 20 June 2011

51 Degrees mobile redirect and Orchard CMS

51 Degrees current version doesn't support Orchard CMS at its current version (1.0.4.1).
This is because part of the "should I redirect this page for the current request?" logic is slightly flawed.

Part of the logic checks that the request context's http handler class type is in the following list (or has a base type of an item in the list):

internal static readonly string[] PAGES = new[]
{
"System.Web.UI.Page",
"System.Web.Mvc.MvcHandler",
"System.Web.Mvc.MvcHttpHandler",
"System.Web.UI.MobileControls.MobilePage",
"System.Web.WebPages.WebPageHttpHandler",
};
Thats not going to work for Orchard, because it's http handler does not inherit from any in the list.

So the fix is to alter the list as so :

internal static readonly string[] PAGES = new[]
{
"System.Web.UI.Page",
"System.Web.Mvc.MvcHandler",
"System.Web.Mvc.MvcHttpHandler",
"System.Web.UI.MobileControls.MobilePage",
"System.Web.WebPages.WebPageHttpHandler",
"Orchard.Mvc.Routes.ShellRoute.HttpAsyncHandler",
"Orchard.Mvc.Routes.ShellRoute+HttpAsyncHandler"
};
The list is in the class FiftyOne.Foundation.Mobile.Redirection.Constants - which is in the file named RedirectionConstants.cs

It's not a great fix - but thats because the code is breaking OCP quite severly, and I don't have time to fix right now.
Hope this post saves someone else several hours of debug !

No comments:

Post a Comment