开发者

Error during redirect to MVC Mobile Area using 51Degrees.mobi

I'm a relative newbie to MVC. The app that I've written works and I continually fine tune it as I learn. Recently, I've been toying with mobile web site tools. I've never needed to do this so I did as much searching/reading/tinkering as I could. I started with the Microsoft Web App Toolkit which ended up being a bit outdated so I kept on reading and eventually switched to using the 51Degrees.mobi library.

I've set it up based on several different posts:

  1. Steve Sanderson - http://www.asp.net/learn/whitepapers/add-mobile-pages-to-your-aspnet-web-forms-mvc-application
  2. 51Degrees User Guide - http://51degrees.codeplex.com/wikipage?title=User%20guide
  3. ...and a bunch of other sites and descriptions all centering around the same basic points.

So here's what I have as described by Mr. Sanderson.

  • Created an MVC Area for my Mobile controllers/views which in turn created the MobileAreaRegistration.cs file

Error during redirect to MVC Mobile Area using 51Degrees.mobi

  • Modified the MobileAreaRegistration.cs under that area to specify the default controller and action.

Error during redirect to MVC Mobile Area using 51Degrees.mobi

  • Included the 51Degrees components in my config file. Namely the sectionGroup references, the fiftyOne section to include the redirect and the httpModule.

    Error during redirect to MVC Mobile Area using 51Degrees.mobi

I have to use the following IIS module for debugging even though I'm using Win7:

Error during redirect to MVC Mobile Area using 51Degrees.mobi

I've also made the necessary modification to the Global.asax.cs file to include the primary namespace so that there's no confusion for the app as to which area it should default to when executing. (as identified in Steve Sanderson's post).

Lastly, I've installed an iphone emulator and android emulators and the code that redirects is in my HomeController. I don't have anything specific yet for each device. I'm still trying to get the redirect to kick in properly.

Error during redirect to MVC Mobile Area using 51Degrees.mobi

When I run the site in the desktop browser (no mobile redirect) it runs fine. When I use the emulators (or try to direct the desktop browser to the mobile site) I get the following error. It sure seems obvious (MISSING CONTROLLER) but it's there. So what am I not seeing?

The requested page cannot be found. (404)

System.Web.HttpException: The controller for path '/Mobile' was not found or does not implement IController. at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) at System.Web.Mvc.DefaultControllerFactory.CreateContro开发者_Python百科ller(RequestContext requestContext, String controllerName) at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

A second set of eyes would be grand! Thanks in advance for the assistance.


Answered!

The issue wasn't with the configuration of the mobile tools and redirection but rather with the namespace of the Mobile section in the Area itself.

My namespaces in my Mobile area controllers were Licensing.Web.Mobile.Controllers. They needed to be Licensing.Web.Areas.Mobile.Controllers.

Once I added "Areas" to the namespace it worked like a champ.

I found this with a bit more digging: Asp.NET MVC 2 and 404

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜