ASP.NET vs. SharePoint: Page Development
Applies to: SharePoint Foundation 2010
This topic points out the most important differences between webpage development in Microsoft ASP.NET 3.5 and in Microsoft SharePoint Foundation.
Application Pages and Site Pages
Among webpages, SharePoint Foundation makes distinctions that are unknown in ASP.NET. To begin with, SharePoint Foundation divides webpages into two broad categories: Application pages and Site pages. There are significant differences in the processes of developing the two types.
Application pages are the most similar to traditional Microsoft ASP.NET 3.5 webpages. However, an application page is not directly derived from System.Web.UI.Page. Instead, it is derived from either LayoutsPageBase or UnsecuredLayoutsPageBase.
Application pages are stored in the file system of the SharePoint Foundation servers in a virtual directory of the SharePoint Foundation web application that is accessible from every website in the web application. Hence, application pages are shared among the websites of a web application.
Perhaps the most crucial difference that developers must be aware of is that application pages do not run in safe mode and can contain inline code. This relaxation of security is possible because application pages can only be installed by a farm administrator.
As a general rule, application pages in a SharePoint Foundation typically have a lot of server controls and relatively little informational content as compared with Site pages.
Site pages tend to be content-oriented. Welcome pages, home pages, and list view pages are all examples of site pages. However, a site page can be highly functional and contain interactive web controls and Web Parts.
Master Pages and Content Pages
SharePoint Foundation makes heavy use of the ASP.NET master page technology. Both application pages and site pages are content pages that reference a master page. For more information about the use of master pages in SharePoint Foundation, see the Master Pages node of this SDK.
SharePoint Foundation mobile pages are much simpler than non-mobile pages. They do not use the ASP.NET master page/content page technology. Nor are they divided into application pages and site pages. SharePoint Foundation mobile pages are all application pages, and they are located in the \_layouts\Mobile folder. There is one respect in which a SharePoint Foundation mobile page is more like a site page: if the page contains a mobile Web Part adapter, the adapter must be registered as a safe control or it is not rendered. For more information about developing with mobile pages, see the Overview of Mobile Pages and the Redirection System node of this SDK.