SPMobileWebUrlRedirect 类

为特定网站 (如博客、 STS,SGS 或自定义的 Web 类型),类型指定 <RenderingTemplate> 标识用作该站点的主页,为移动设备的文件的 ID。

继承层次结构

System.Object
  System.Web.UI.Control
    System.Web.UI.WebControls.WebControl
      Microsoft.SharePoint.Mobile.WebControls.SPMobileComponent
        Microsoft.SharePoint.Mobile.WebControls.SPMobileTemplateSelector
          Microsoft.SharePoint.Mobile.WebControls.SPMobileWebTemplateSelector
            Microsoft.SharePoint.Mobile.WebControls.SPMobileWebUrlRedirect

命名空间:  Microsoft.SharePoint.Mobile.WebControls
程序集:  Microsoft.SharePoint(位于 Microsoft.SharePoint.dll 中)

语法

声明
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class SPMobileWebUrlRedirect _
    Inherits SPMobileWebTemplateSelector
用法
Dim instance As SPMobileWebUrlRedirect
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public sealed class SPMobileWebUrlRedirect : SPMobileWebTemplateSelector

备注

<RenderingTemplate> ID 具有以下形式。

Mobile_WebSiteType_PageType_Redirect

"移动"为前缀,以指示 <RenderingTemplate> 移动不为主页页面使用 Web 部件页的 Web 站点。

PageType是一种页如主页或 NewForm。但通常,主页是唯一以往任何时候都需要重定向移动设备的页类型。

"重定向"表示该 <RenderingTemplate> 标识移动设备应被重定向到的页面的 URL。

SPMobileWebUrlRedirect对象被实例化时, SPContext由 ID 的WebSiteType部分。

对于内置 Web 站点类型随SharePoint Foundation, WebSiteType是 (SharePoint WEBTEMP.XML文件) 的协作应用程序标记语言 (CAML) <Template> 元素的名称属性的值。例如,博客网站定义的名称值是"网络日志"。因此, SPMobileWebUrlRedirect对象定义以下 <RenderingTemplate> ID 对于移动博客主页。

Mobile_BLOG_HomePage_Redirect

有关自定义网站定义的WebSiteType部分 <RenderingTemplate>'s ID 是 (中的自定义WEBTEMP*.XML文件) 的 <Template> 元素的 ID 特性的值不是名称属性。假设您有一个包含下面的 <Template> 元素的WEBTEMPMyCustomSiteDefinitions.XML文件。

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

SPMobileWebUrlRedirect对象定义移动主页下面的 <RenderingTemplate> ID。

Mobile_10001_HomePage_Redirect

下面是控制移动设备的重定向的 MobileDefaultTemplates.ascx 文件 (在%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\TEMPLATE\CONTROLTEMPLATES) 的部分。

请注意最初被称为 MobileHomePageRedirect <RenderingTemplate>。它,反过来,调用SPMobileWebUrlRedirect对象。如果上下文为博客网站, SPMobileWebUrlRedirect对象定义作为下一个 <RenderingTemplate> 来调用 Mobile_BLOG_HomePage_Redirect,移动设备将被重定向到 bloghome.aspx。在所有其他情况下,如果没有任何自定义站点定义,没有 <RenderingTemplate> (其中WebSiteType是一个博客不同的网站类型) 的名称 Mobile_WebSiteType_HomePage_Redirect 与被找到。所以名为 <RenderingTemplate> 使用 Mobile_Default_HomePage_Redirect,和它将重定向到移动设备 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:SPMobileHomePageRedirection RunAt="Server" />
  </Template>
</SharePoint:RenderingTemplate>
<SharePoint:RenderingTemplate RunAt="Server" id="Mobile_BLOG_HomePage_Redirect">
  <Template>
    <SPMobile:SPMobileHomePageRedirection RunAt="Server" PageFileName="bloghome.aspx" />
  </Template>
</SharePoint:RenderingTemplate>

如果没有自定义的 *.ascx 文件,包含 <RenderingTemplate> 的...\CONTROLTEMPLATES文件夹中使用名称Mobile_WebSiteType_HomePage_Redirect (其中WebSiteType是 <Template> 自定义的 ID 号),则将使用由该 <RenderingTemplate> 指向的网页。

线程安全性

该类型的任何公共 静态 (已共享 在 Visual Basic 中) 成员都是线程安全的。不保证任何实例成员都是线程安全的。

另请参阅

引用

SPMobileWebUrlRedirect 成员

Microsoft.SharePoint.Mobile.WebControls 命名空间

其他资源

WebTemp.xml

How to: Customize the Home Page through Redirection