Do you know in SharePoint there are two types of pages?
In a SharePoint site each page you see is either a ghosted page or an unghosted page.
Ghosted (Uncustomized) Pages
These are the pages stored in the severs file system but not in the database. The other important thing is these files are common to all the site collections within the SharePoint server and are generally based on the "out of the box" site definition templates. Basically they are working as template files. Ghosted pages are faster since ASP.NET parser will be used to parse them and as you might know ASP.NET parser will compile the page into an assembly on the first time it is rendered, on subsequent executions the compilation is skipped since the assembly is already there.
When ghosted pages are modified by SharePoint designer then they will become unghosted pages, and then SharePoint will start using that file in the future not the file stored in the file system. A common example for this would be the “default.master” file on the “C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\Global“.
Unghosted (Customized) Pages
These are the pages which are stored on the database. Unghosted pages are specific to the SharePoint web site the page is in. If you change these files it will not affect any other site in the same SharePoint server. Unghosted pages will be parsed by the safemode parser which will not compile the pages. The only dynamic code allowed is server-side controls that are marked safe (Safe Controls, Trusted Controls).
Why Ghosting?
This allows SharePoint to,
- Increase it’s performance by enabling caching the main site template into memory and then apply the changes that are stored in the database for the specific file.
- Increases security by not allowing unghosted pages to run code so an attacker who injects code will not be able to crash your server.