How does SharePoint store pages?
SharePoint does not store the pages directly in the filesystem. The mechanism is a little less straightforward.
To understand this mechanism, You have to understand the concepts of
Ghosting/Unghosting, and the ASP.NET Virtual Path Provider.
The
SharePoint stores the pages in the Database as BLOBS, and serves them up
using the ASP.NET Virtual path provider.
The ASP.NET Virtual Path Provider provides an abstraction between
ASP.NET and FileSystem.
Instead of getting a System.IO.FileStream object
directly from the filesystem, the provider uses
MapPathBasedVirtualPathProvider and the MapPathBasedVirtualFile classes
to get the FileStream object.
This abstraction allows ASP.NET to serve up pages from anywhere,
without having to store the pages in an actual file system. This concept
is used to implement Ghosting/Unghosting which basically means having a
single copy of the page, and serving them up as different pages.
SharePoint leverages this new feature in ASP.NET 2.0, along with the
improved BLOB storage functionality in SQL Server 2005 to serve up
pages.
What are SharePoint Ghosted and Unghosted Pages
Each .aspx page is rendered by one of two possible parsers. When a
request is received for an .aspx page, the SharePoint isapi filter
determines who will handle the rendering of the page—Asp.net orthe SharePoint SafeMode parser. The first parser, Asp.net, requires the least amount of introduction. The second parser is unique to Windows SharePoint Services.
As everyone knows, all pages within SharePoint are stored in the
database. This effectively means that for each document, you will find a
row in the docs table for that document. The actual file is stored in
the Content column. This is true
for all files. However, there is one exception - some .aspx pages don't
actually have their content stored in the database. Instead, these pages
reference files which exist on the server's file system. These pages
are considered ghosted pages.
From a technical standpoint, ghosted pages are those rows in the docs table which have null values for the Content column and a non-null value for the SetupPath column
which points to a file on the file system itself. The referenced file
essentially serves as a template and content source.
What pages are ghosted? For example, the default home page is a ghosted
page. Any web part pages created via New Web Part Page user
interface also ghosted.
What does it mean if a document doesn't reference a template on the file system? Or, more to the point, the Content column actually contains data? These pages are known as unghosted .aspx pages and they are routed through the SafeMode parser.
What is the main difference between the SafeMode parser and Asp.net?
As everyone knows, Asp.net will parse a page on first render and compile it into an assembly. The SafeMode parser does NOT compile
pages. It is designed to interpretatively parse a page and create the
object structure of the page. In the event inline server-side code is
detected, the SafeMode parser will not
allow the page to render. Additionally, the only objects within the page
(i.e. controls marked as runat=server) which can be instantiated are
those items found in the SafeControls list.
Can a page transition from a ghosted state to unghosted?
Yes, Ghosted pages become unghosted once
a file has been modified. If a page is updated using FrontPage 2003,
web folders, or the modification of custom document library fields, the Content column of the given document row is populated with the page contents. All uploaded .aspx files are automatically unghosted.
No comments:
Post a Comment