Share via


SPMobileWebUrlRedirect Class

Specifies, for a particular Web type (such as BLOG, WIKI, STS, MPS, or a custom Web type), the ID of the <RenderingTemplate> that identifies the file that serves as the site's home page for mobile devices.

Inheritance Hierarchy

System.Object
  System.Web.UI.Control
    System.Web.UI.MobileControls.MobileControl
      Microsoft.SharePoint.MobileControls.SPMobileComponent
        Microsoft.SharePoint.MobileControls.SPMobileTemplateSelector
          Microsoft.SharePoint.MobileControls.SPMobileWebTemplateSelector
            Microsoft.SharePoint.MobileControls.SPMobileWebUrlRedirect

Namespace:  Microsoft.SharePoint.MobileControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
Public NotInheritable Class SPMobileWebUrlRedirect _
    Inherits SPMobileWebTemplateSelector

Dim instance As SPMobileWebUrlRedirect
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
public sealed class SPMobileWebUrlRedirect : SPMobileWebTemplateSelector

Remarks

The <RenderingTemplate> ID has the following form.

Mobile_WebSiteType_PageType_Redirect

The "Mobile" is a prefix that indicates that the <RenderingTemplate> is for mobile Web sites.

The PageType is the type of page, such as HomePage or NewForm. But ordinarily HomePage is the only page type that ever needs to redirect mobile devices.

The "Redirect" indicates that <RenderingTemplate> identifies the URL of the page to which the mobile device should be redirected.

The WebSiteType portion of the ID is determined by the SPContext when the SPMobileWebUrlRedirect object is instantiated.

For built-in Web site types that ship with Windows SharePoint Services 3.0, the WebSiteType is the value of the Name attribute of the Collaborative Application Markup Language (CAML) <Template Element (Site)> element (of the SharePoint WEBTEMP.XML file). For example, the Name value for the blog site definition is "BLOG". Hence, the SPMobileWebUrlRedirect object defines the following <RenderingTemplate> ID for a mobile blog home page.

Mobile_BLOG_HomePage_Redirect

For custom site definitions, the WebSiteType portion of the <RenderingTemplate>'s ID is the value of the ID attribute of the <Template Element (Site)> element (in a custom WEBTEMP*.XML file), not the Name attribute. Suppose you have a WEBTEMPMyCustomSiteDefinitions.XML file containing the following <Template Element (Site)> element.

<Template Name="MyFirstCustomSiteDefinition" ID="10001"> 

The SPMobileWebUrlRedirect object defines the following <RenderingTemplate> ID for the mobile home page.

Mobile_10001_HomePage_Redirect

The following is the portion of the MobileDefaultTemplates.ascx file (in C:\\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES) that controls redirection for mobile devices.

Note that initially the MobileHomePageRedirect <RenderingTemplate> is called. It, in turn, calls the SPMobileWebUrlRedirect object. If the context is a BLOG site, the SPMobileWebUrlRedirect object defines Mobile_BLOG_HomePage_Redirect as the next <RenderingTemplate> to call and the mobile device is redirected to bloghome.aspx. In all other cases, if there are no custom site definitions, no <RenderingTemplate> with the name Mobile_WebSiteType_HomePage_Redirect (where WebSiteType is a Web site type other than BLOG) is found. So the <RenderingTemplate> named Mobile_Default_HomePage_Redirect is used, and it redirects the mobile device to mbllists.aspx.

<SharePoint:RenderingTemplate RunAt="Server" ID="MobileHomePageRedirect">
  <Template>
    <SPMobile:SPMobileWebUrlRedirect RunAt="Server" />
  </Template>
</SharePoint:RenderingTemplate>
<SharePoint:RenderingTemplate RunAt="Server" 
  ID="Mobile_Default_HomePage_Redirect">
  <Template>
    <SPMobile:SPMobileUrlRedirection RunAt="Server" 
      PageFilename="mbllists.aspx" />
  </Template>
</SharePoint:RenderingTemplate>
<SharePoint:RenderingTemplate RunAt="Server" 
  ID="Mobile_BLOG_HomePage_Redirect">
  <Template>
    <SPMobile:SPMobileUrlRedirection RunAt="Server" 
      PageFileName="bloghome.aspx" />
  </Template>
</SharePoint:RenderingTemplate>

If there is a custom *.ascx file in the ...\CONTROLTEMPLATES folder that contains a <RenderingTemplate> with the name Mobile_WebSiteType_HomePage_Redirect (where WebSiteType is the ID number of a custom <Template Element (Site)>), then the page pointed to by that <RenderingTemplate> will be used instead of mbllists.aspx.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

SPMobileWebUrlRedirect Members

Microsoft.SharePoint.MobileControls Namespace

Other Resources

WebTemp.xml

How to: Customize the Mobile Home Page through Redirection