Search Wiki:
This Web Application Toolkit is designed to demonstrate how to extend an existing ASP.NET MVC Web application to provide access from mobile devices. To enable mobile access, the Web application should have views targeting each of the mobile devices to be supported.

The MVC pattern helps you create applications that separate the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements. The pattern specifies where each kind of logic should be located in the application. The UI logic belongs in the view. Input logic belongs in the controller. Business logic belongs in the model. This separation helps you manage complexity when you build an application, because it enables you to focus on one aspect of the implementation at a time. For example, you can focus on the view without depending on the business logic.

In this Web Application Toolkit we use the MVC pattern to create several views targeting different kind of browsers reusing the same business logic. For this implementation, we use the ASP.NET MVC framework which provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications. The ASP.NET MVC framework is a lightweight, highly testable presentation framework that is integrated with existing ASP.NET features, such as master pages and membership-based authentication.

For extending the Web application to use mobile specific views, this sample provides a reusable component called MobileCapableViewEngine that enables the Web application to show the appropriate view depending on the device's browser that is performing the request.



55d4058f-7244-4bf1-974a-e9e1068a6b23.png
Last edited Jul 26 2009 at 8:27 AM  by jamescon, version 2
Comments
hoserdude wrote  Feb 25 2010 at 7:12 PM  
A few tweaks and this appears to work on MVC 2. I had to hack the proj file to use <ProjectTypeGuids> from another MVC project I had. Also had to change the refs to MVC 1 in the project, as well as the two web.configs.

JPEvans wrote  Mar 2 2010 at 11:53 AM  
Is the source C# only - or is there a VB.Net version?

argrithmag wrote  Aug 2 2010 at 7:14 PM  
Thanks for the updates!

argrithmag wrote  Aug 2 2010 at 7:25 PM  
One thing to note, ascx files aren't handled correctly. I built the standard project, then copied the DeviceDetails.ascx file to the WindowsMobile directory, and added some text above the device details so that I know that i was displaying the correct partial view when rendered. And the DeviceDetails, was not rendered from theShared\Mobile\WindowsMobile directory, only the standard DeviceDetails.ascx was rendered.

rkum32 wrote  Aug 11 2010 at 2:52 PM  
what is difference between web development toolking and browser definition file while developing mobile sites. because both requires diff views

xshuster wrote  Sep 18 2010 at 8:57 PM  
Hi, I have been working in mobile web app for some weeks and all works fine except when using partials. Is there any workaround? by now I'm putting the logic into the controller asking for Request.Browser.IsMobileDevice in order to display the correct PartialView. Thanks in advance. Good work!!

Corobori wrote  Feb 16 2011 at 1:30 AM  
I am having a small problem using the Web Mobile Toolkit: "The Project Type is no supported by this installation" ? What am I missing see http://www.corobori.com/sos/MobileWeb.jpg

alexandern wrote  Mar 26 2011 at 9:06 PM  
guys, make sure you test it by hitting the site with a regular browser and then a mobile device. It's very likely the mobile device will get the browser version. And yes you have to test this in release mode and preferably under hosting conditions. You'll realize this solution doesn't work due to caching issues.

Updating...
Page view tracker