Overview of Mobile Pages and the Redirection System
Last modified: May 05, 2010
Applies to: SharePoint Foundation 2010
Microsoft SharePoint Foundation provides an architecture to support mobile access to SharePoint pages and list data. Users of mobile devices navigate to the same URLs as do users of desktop browsers. The mobile device is automatically redirected to a version of the page that is optimized for mobile devices. From there, they can use navigation links in the footer section of the mobile page to navigate among the home page, the all content ("list of lists") page, list view pages, and mobile version of custom site pages including Web Part pages and wiki-enabled pages. There are also mobile versions of the New item, Edit item, and Display item forms. Any list that has a mobile view is accessible. A mobile view is simply a standard SharePoint list view marked for additional use as a mobile list view. For more information, see Mobile Views.
You can access a mobile page through a mobile device emulator. For information about setting up an emulator, see Preparing to Develop Mobile Device Access to SharePoint. You can also access a mobile page of a site through an ordinary Web browser, such as Internet Explorer, by appending "?Mobile=1" to the end of the URL of the page. (In previous versions of SharePoint Foundation, you inserted "/m" at the end of a Web site URL. For purposes of backward compatibility, this method can still be used, but you must first enable the legacy MobileRedirection feature. (This feature is enabled with a SharePoint Management Shell cmdlet: Enable-SPFeature –identity "MobileRedirection" –URL http://Server/SiteURL.) Correspondingly, you can force a mobile device to load a nonmobile page by entering the URL of the nonmobile page and appending "?Mobile=0" to the end of the URL.
SharePoint Foundation detects requests from mobile devices and automatically changes the URL of the requested nonmobile page to its mobile substitute.
The nonmobile page to which a mobile page corresponds is called the "target page" of the mobile page.
This detection process is implemented by SPRequestModule in the BeginRequest event of the HTTP request lifecycle. You cannot modify or replace SPRequestModule, but there is a second kind of redirection that you can modify. For more information, see the section Home Page Redirection below. For more information about SPRequestModule and the page request lifecycle in SharePoint Foundation, see Microsoft SharePoint Foundation as an ASP.NET Application.
Like all requests from a mobile device, a request for the home page of a Web site is automatically redirected to a version of the page that is optimized for viewing from a mobile device. At a minimum, that is what happens if the requested URL includes only the Web site URL, without specifying a page, such as http://MyServer/MySite, or if the URL specifies a page name other than the default.aspx page, such as http://MyServer/MySite/HomePage.aspx. But if the URL explicitly specifies default.aspx as the page, such as http://MyServer/MySite/default.aspx, a special kind of redirection that developers can modify, called "Home Page Redirection," is invoked. The initial redirection during the BeginRequest event directs the request to a special default.aspx page located at _layouts\Mobile. This file, however, does not actually render. Its content is mainly a control that re-redirects the request to another page. If the requested home page is, for example, a blog site, the second stage of redirection goes to the _layouts\Mobile\bloghome.aspx file. If the home page is for a Team site or Group Work site, or any other mobile-supported site type except blog, then the request is redirected to _layouts\Mobile\mblwp.aspx. (If the mobile device browser uses either CHTML or WML, then even wiki-enabled pages are redirected to _layouts\Mobile\mblwp.aspx, because the browser cannot render Rich Text.) This second stage of redirection is customizable: you can substitute a custom mobile home page and that page can have links to other custom mobile pages. For more information, see How to: Customize the Mobile Home Page Through Redirection. If the request is for the home page of a custom Web template, redirection behavior is determined by the site definition from which the Web template ultimately derives.
As noted above, you may occasionally want to force a computer browser to open a mobile page by appending "?Mobile=1" to the end of the URL of the page. To force the computer browser to invoke Home Page Redirection, specify default.aspx as the page name, for example:
If the legacy MobileRedirection feature has been activated for the Web site, then adding
on either a computer or mobile device browser also invokes Home Page Redirection.
Home Page Redirection is supported for any Web site that is based on the STS, SGS, or BLOG site definitions. It can be enabled for custom site definitions. For more information about site definitions in SharePoint Foundation, see Site Definitions and Configurations and WebTemp.xml.
Mobile access is not supported for Web sites based on the MPS, CENTRALADMIN, TENANTADMIN, or legacy WIKI site definitions.
In addition to having an entirely different set of pages for mobile access, SharePoint Foundation also has an entirely separate set of controls for the mobile pages. Unlike server controls of the Microsoft.SharePoint.WebControls namespace which are typically used in Web site pages displayed in the browser, SharePoint Foundation mobile controls of the Microsoft.SharePoint.MobileControls namespace used in mobile pages inherit from Microsoft ASP.NET controls of the System.Web.UI.MobileControls namespace.
Mobile pages can also have controls that approximately duplicate the behavior of Web Parts on nonmobile Web Part pages. These controls are called mobile Web Part adapters and they can render only on mobile Web Part pages (mblwp.aspx).
The system for rendering lists, list items, and fields is essentially the same on mobile list view pages and forms as it is on nonmobile pages. The main difference is that rendering limits are imposed on the length fields and the number of items that can appear n a list. Excessively long fields are truncated. Lists that exceed the limit are paginated.
SharePoint list schemas determine the content of lists on mobile pages just as they do on nonmobile pages. The following are some of the ways that the list schema determines what renders:
Sections in a list schema determine the sort order, filters, and view fields in a mobile list view.
Boolean attributes in a view schema specify whether the view is a mobile view and whether it is the default mobile view.
Field order in a form schema determines the field order in a mobile list item form page.
Boolean attributes in a field schema determine whether a given field is shown in a new form, an edit form, or a display form or whether the field is hidden.
SharePoint Foundation mobile features use a system of rendering templates that is similar to the one implemented for pages displayed in the browser. The MobileDefaultTemplates.ascx and GbwMobileDefaultTemplates.ascx files in the %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\CONTROLTEMPLATES directory contain all the default rendering template definitions that are used in mobile pages.
Modifying the contents of the MobileDefaultTemplates.ascx and GbwMobileDefaultTemplates.ascx files is not supported and can break mobile features in SharePoint Foundation.
You can customize the way that any mobile page renders (for example, home, view, form pages, and so on) by creating user control templates (.ascx files) within the \CONTROLTEMPLATES folder. You can define specific rendering of controls according to site type, list type, or field type.
SharePoint Foundation support for mobile blogging includes support for all the other SharePoint mobile features, such as pagination, list field customization, mobile view customization, mobile home page redirection, and so on. To build your own mobile blog solution, you can customize SharePoint mobile blog pages and mobile controls similarly to the way you customize other mobile pages and controls.