How does Mobile customize the homepage through redirection?

Source: Internet
Author: User

By default, WSS uses an upstream/downstream redirection mechanism on the website. The Mobile homepage adds an "m" folder (for example, http (S): // Server/sites/Site/m/) to the end of a traditional URL /) default used to redirect requests to mobile. aspx page. The default. aspx page redirects the user to the actual homepage. Based on the type defined by the current site, the following operations are performed in sequence:

  1. Only one control is placed in default. aspx, which tells the runtime to find the RenderingTemplate named "MobileHomePageRedirect.
  2. When running, search for all *. ascx Files located in Local_Drive: \ Programe Files \ Common Files \ Microsoft Shared \ web server extensions \ 12 \ TEMPLATE \ CONTROLTEMPLATES and find the name through RenderingTemplate. The mobiledefatemtemplates. ascx file will find one.
  3. The Template attribute of the MobileHomePageRedirect control points to an object of the SPMobileWebUrlRedirect class at runtime.
  4. The SPMobileWebUrlRedirect object uses Mobile_SiteTypeID_HomePage_Redirect to construct the name of another RenderingTemplate. The SiteTypeID is the name defined by the WSS site, such as STS or the ID number defined by a custom site, such as 10001. (For more information about mobile website redirection, see the remarks section in SPMobileWebUrlRedirect)
  5. Use the second RederingTemplate to search for all *. ascs files under... \ 12 \ TEMPLATE \ CONTROLTEMPLATES again at runtime.
    • If SiteTypeID is a BLOG, Mobile_BLOG_HomePage_Redirect RenderingTemplate is found in mobiledefatemplate template. ascx during runtime. The Template attribute of this control points to a SPMobileUrlRedirection class object at runtime. The PageFileName attribute of this object specifies bloghome. aspx as the final homepage.
    • If SiteTypeID is not a BLOG and no custom. ascx file is created, Mobile_Default_HomePage_Redirect RenderingTemplate in mobiledefatemplate. ascx will be used at runtime. The Template attribute of the control points to an object of the SPMobileUrlRedirect class at runtime, and its PageFileName attribute specifies the final homepage as listing lists. aspx.

You can create a custom control to redirect users to your pre-designed mobile homepage.

Steps:
  1. Create a custom mobile homepage, for example, MyHome. aspx.
  2. Place the new homepage in the following directory:
    Local_Drive: \ Programe Files \ Common Files \ Microsoft Shared \ web server extensions \ 12 \ TEMPLATE \ LAYOUTS \ MOBILE
  3. Create a custom control template file. For example, MyMobileControlTemplate. ascx (For details, refer to the example below)
  4. Place the new control template in the following directory:
    Local_Drive: \ Program Files \ Common Files \ Microsoft Shared \ web server extensions \ 12 \ TEMPLATE \ CONTROLTEMPLATES
  5. Restart IIS, And Then browse the website to see the customized results.

Note::
If you use a mobile device simulator on your computer, instead of an actual mobile device, you may need to delete the Temporary internet file after each modification to ensure that the new version of the page is displayed.

Example

The following example shows the content of a custom. ascx file (for example, MyMobileControlTemplate. ascx), which defines a control template. When a mobile device accesses a website defined by the "MySiteType" website, it is directed to the home page MyHome. aspx. Note the following content of the custom file:

  • All the statements marked with "% @" are formulated. This applies to all custom pages.
  • "MySiteType" can be:
    • The name defined by the workgroup site: "STS ". MPS, CENTRALADMIN, And WIKI websites do not support access through mobile devices. The BLOG site definition can be accessed through mobile devices, but there is alreadyMobile_BLOG_HomePage_RedirectOfRenderingTemplate, Which is defined in the mobiledefatemplates. ascx file. You cannot modify the file. You can create the second one in the custom. ascx file.RenderingTemplateAlso namedMobile_BLOG_HomePage_RedirectBut this will damage the existingMobile_BLOG_HomePage_RedirectOr third-party solutions.
      Note:
      The RenderingTemplate built in WSS is loaded first. Therefore, when a custom template with the same name is loaded, the standard rendering template is overwritten. If two or more custom renderingtemplates have the same name, the last one in alphabetical order of the file names will overwrite the others. If a given file contains two or more templates of the same name, these templates will not be loaded.
      Note::
      The website definition Name is set in the Name attribute of the Template element in the WebTemp. xml file.
    • Any ID number (not Name) defined by the user-defined website that has been created)
      Note::
      The website-defined ID is set in the ID attribute of the Template element in the WebTemp. xm file.

Important:

In the Onet. xml file, the Configuration element of the site-defined Configuration must have a WebFeature element and must contain the redirection of the following Feature element:

<Feature ID = "F41CC668-37E5-4743-B4A8-74D1DB3FD8A4"/> (Note: This is a sign inherited from the STS website ).

C #

<%@ Register TagPrefix="SPMobile" Namespace="Microsoft.SharePoint.MobileControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><SharePoint:RenderingTemplate RunAt="Server" ID="Mobile_MySiteType_HomePage_Redirect">  <Template>    <SPMobile:SPMobileUrlRedirection RunAt="Server" PageFileName="MyHome.aspx" />  </Template></SharePoint:RenderingTemplate>

 

 

Reprinted: http://www.cnblogs.com/Sunmoonfire/archive/2008/07/10/1239638.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.