sábado, 28 de enero de 2012

Custom SharePoint Pages – Site Pages vs Application Pages

Here are major characteristics and differences between site pages and application pages categorized by major areas of architectural decisions.

  • Characteristics
    • An Application page is an ASP.NET content page hosted in the LAYOUTs directory on the WFEs and inherits from Microsoft.SharePoint.WebControls.LayoutsPageBase. Site Pages are stored in the virtual file system in the Content databases. SPFile and SPFolder objects represents Site Pages in WSS object model.
    • As Name Suggest, An Application Page is application or farm scoped and A site page is  site/web scoped.
    • Site Pages consists of two compoents => Site Page Templates vs Site Page Instances
      • Site Page Templates are .aspx pages stored in the file system in the FEATURES directory.
      • Site Page Instances are provisioned through Module and File elements and resides in content database. They are created inside the context of the particular site. WSS treats Un-customized Site Page Instances as a reference pointer to the Site Page Template. You can use SharePoint Designer to customize or view site page instances. Both customized or un-customized site pages exposed through the virtual file system.

 

  • Coding
    • An application page can have code behind and inline code but site page can’t have code behind or inline code. Using PageParserPaths for site pages is not best practice. Workaround for this problem is to create the site pages with web part pages and add web parts which has codebehind during feature activation.
    • An application page doesn’t support web parts or web part zones (they are ghosted pages) but Site Pages supports web parts. It means application pages would support only server controls or user controls and cannot be personalized by end-users.
  • Customization
    • An application page typically requires Visual Studio to customize the page, while Site Page can be easily customized through SharePoint Designer. First time you change the site page template or site page instance through SharePoint designer, it creates a customized copy and stores in the virtual file system. Use “Reset to Site Definition” to reset customized site page to the non-customized site page.
    • An application page doesn’t support customization per site by site basis but site page supports different Site Pages per Site
  • Deploy
    • An application page is available to all the sites, while site page can be deployed only specific sites
    • An application page is deployed in LAYOUTS directory when solution is deployed to the web application or farm, while site pages are deployed to content database when feature is activated for specific web. Site page templates gets deployed in FEATURES directory same way as application page when solution is deployed.
    • An application page must requires a farm solution, while SitePage can be deployed using a sandbox solution. It means, application pages requires farm administrative privileges to deploy the changes while site pages can be deployed by site       collection administrators/end-users.
  • Runtime
    • URL – An application page stored in the _layouts directory on each WFEs which would add “_layouts” in URL, while site page URLs can have fully customized business URLs. This can be go-no go decision with application pages in most cases.
    • Performance – Because application pages are parsed and compiled as classic ASP.NET pages, they run faster than site pages. SPPageParserFilter parses and compiles the page into DLL. Customized Site Pages impact performance and scalability since they are rendered, runs in no-compile mode, and retrieved from the virtual file system.
  • Upgrade
    • Maintaining or deploying updated Application page is much faster than maintaining Site Page because deployment method requires retracting/re-deploying site page on each site compare to application page on each application. This can be go-no go decision with site pages in thousands of sites deployment.
  • Cleanup
    • Application pages are removed from the file system from the LAYOUTs folder when the solution is retracted but Site Pages requires Feature Receiver to delete the folder containing site pages in the content database during feature deactivation process. Site page templates gets retracted from FEATURES directory same way as application pages when solution is retracted.

 

Fuentes:

http://srisharepointdevelopment.blogspot.com/2011/07/app-page-vs-site-pages.html

http://nikspatel.wordpress.com/2012/01/20/custom-sharepoint-pages-site-pages-vs-application-pages/

Más información:

http://www.sharepointbasic.com/2011/12/pages-in-sharepoint_20.html

No hay comentarios:

Publicar un comentario