This is a noob question... I am trying to understand how site definitions, templates, etc. all work together when a SharePoint page is requested. I understand that site definitions are "base templates" while site templates capture the "delta" between site definitions and applied customizations.

When a page request is received by SharePoint, how does SharePoint know which base site definition to use? I looked at the Web table (in the content DB) and see a WebTemplate column. I was able to map that back to the templates defined in WebTemplate XML files located at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML\WebTemp*.xml. Does each Template in these files correspond to a folder under ....\SiteTemplates\?

With customization, use of custom site templates (STP files) and pages getting unghosted (or customized), I have heard that the pages or templates themselves are stored in the database as opposed to using those on the WFE server.

I could not find any one explanation or article that paints the whole picture!

3 Answers 3


The Site Definitions are not examined when rendering a page but during provisioning.

For a detailed explanation of the rendering see the link provided by @Moss Farmer, but let me give a shorter version here.

Application pages (from _layouts)
Application pages are just ordinary ASP.NET pages which are rendered from a virtual directory.

Site pages
The site pages are a bit more complicated, but the basic is that for each there is a record in the content database (AllDocs) with a column (SetupPath) specifying where in the SharePointRoot the original page is stored and a bit (HasStream) specifing if the page has been customized (unghosted). If the page is uncustomized (ghosted) it's rendered from the SharePointRoot file.
If the page is customized (unghosted) the content is found in another table (AllDocStreams) in the content database and rendered from here.

The Site definitions/Site Templates/Web Templates/Features are all things which is used when you create the Site collection/Site to provision the pages (amonst other things)

  • 2
    I see that you have mentioned Site Pages ghosting and unghosting in a way that requires querying or exploring the content databases. I have always wanted to understand the nitty gritty of the various sharepoint driven content database, stored procs ,etc. Forgive me if this comment seems a bit off topic but can you provide us with some links that discusses the SP content databases in details.
    – ArkoD
    Commented Jul 15, 2012 at 18:11
  • @MossFarmer You can find description of parts in File Operations Database Communications Protocol Specification both Tables and Stored Procs Commented Jul 15, 2012 at 18:37
  • Wonderful. Just what I needed. A big Thanks to you Per. :)
    – ArkoD
    Commented Jul 15, 2012 at 18:49
  • @PerJakobsen, I customized a site (no master pages, etc. only UI changes like adding web parts, lists, etc.) and saved to a site template, and then provisioned a new site using that template. Based on everything I have read, the new site is provisioned from the base site definition, and then the "delta" is applied to the new site, based on what is stored in the template. If this is close to being correct, then when a SP page is requested, will SharePoint use both WFE files as well as something stored in the content DB associated with the STP file? Any unghosting happening in this process?
    – Web User
    Commented Jul 17, 2012 at 12:51
  • The new site will have the same pages in unghosted state as the one used to create the template, so in your scenarion no pages will be unghosted Commented Jul 17, 2012 at 13:09

Speaking of page rendering process its pretty much the same with 2007 and 2010. Please read this lengthy 2 part architectural series of SharePoint by Microsoft that explains in depth of how a requested page is rendered by SharePoint.


This should "almost" answer the basic questions you have above.


The article suggested by Moss Farmer explains how SharePoint sits on top of ASP.NET Framework and IIS and also explains general SharePoint page processing. It will also explain the difference between rendering of ghosted and unghosted page.

As far as Site Definition and Site Templates, they have nothing to do with Rendering of page. Site Definitions and Site Templates are just provisioning framework. When you use them, SharePoint provisions different artifacts in the site. Think of them as a way to describe what should the site consists of and which functionality should be enabled when you create a site using a particular site definition. This is one-time operation which basically sets up the site as per the need. For example, Publishing Site Definition will create a site, create libraries like Pages, Reusable Content, Style Library, Put some page layouts in master page gallery, create a page in Pages library, enable publishing workflow template and publishing feature, create a sub site, installs master pages in master page gallery and sets one of the master page as default master page etc. All that share point does is execute the content of XML definition and performs actions like above.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.