How to create a application Page for SharePoint 2010

Source: Internet
Author: User
Tags object model visual studio visual studio 2010

If you don't know what application Page is, you can refer to the article I've written before. The page model for SharePoint 2010 has not changed much, and the basic and 2007 are consistent. Creating a application Page for SharePoint 2010 is much more convenient for developers than 2007, because Visual Studio 2010 provides good tool support.

As the following illustration shows, developers can add a application Page directly to a SharePoint project:

In SharePoint 2010, the custom application page is still inherited from the Microsoft.SharePoint.WebControls.LayoutsPageBase class by default:

In addition to support on the tools, SharePoint 2010 's application page already has access to the master page of the Web site, which means that after the designer has designed a custom master page for the site, application Page can also show the same effect as the Web site content page.

As the following illustration shows, by specifying the value of the "Dynamicmasterpagefile" attribute (note not "MasterPageFile") in the <@ page> tab of the Application Page page, you can let application Page directly uses the master page of the Web site that the user is currently browsing.

The value of the "Dynamicmasterpagefile" property can be:

"~masterurl/default.master": Represents the master page that will be identified using the Spweb.masterurl property, which defaults to the "V4.master" file in the Site Master page gallery.

"~masterurl/custom.master": Represents the master Page that will be identified by using the Spweb.custommasterurl property, which, by default, is consistent with the value of Spweb.masterurl and is referenced by the V4.master ".

If you still want application page to use the "Application.master" or "Applicationv4.master" in the "14\templates\_layouts" directory, do not use the " Dynamicmasterpagefile property, and you should still use the "MasterPageFile" property.

Although the "Dynamicmasterpagefile" property of the Application page allows application page to use the Web site's master page, the system administrator can also cancel this setting. In Web application Management in SharePoint 2010 Central Administration, by setting the options shown in the following illustration to no, the application page cannot refer to the master page of the Web site:

Of course, you can do the same thing with the object model:

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/web/sharepoint/

If you pass these two methods, the application page is not allowed to use the master page of the Web site, and the "Dynamicmasterpagefile" attribute is specified in "<@ page>", then application Page will look for "v4.master" in the "14\templates\layouts" directory.

Finally, the following special application page, because they may need to be displayed on any occasion (such as when the user is not authenticated), will use the simplest master page of "Simple.master":

Login.aspx

Signout.aspx

Error.aspx

Reqacc.aspx

Confirmation.aspx

Webdeleted.aspx

Accessdenied.aspx

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.