16.01.2013 Views

Microsoft Sharepoint Products and Technologies Resource Kit eBook

Microsoft Sharepoint Products and Technologies Resource Kit eBook

Microsoft Sharepoint Products and Technologies Resource Kit eBook

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 37: Using Visual Studio .NET to Create Web Parts 1003<br />

Ghosted pages are all Web Part Pages that are rendered from the root virtual<br />

directory main application root <strong>and</strong> its subfolders, as well as Web Part Pages stored<br />

in SharePoint document libraries. Ghosted pages do not include pages that come<br />

from the child virtual directories _layouts <strong>and</strong> _vti_bin. Examples of ghosted pages<br />

are the default home page <strong>and</strong> the new Web Part Pages. A ghosted page becomes<br />

unghosted once the page or one of its properties has been modified, for example,<br />

using <strong>Microsoft</strong> FrontPage 2003 or Web folders. The state of a Web Part Page has significant<br />

consequences during Web Part Page rendering.<br />

Web Part Page Rendering<br />

In a SharePoint <strong>Products</strong> <strong>and</strong> <strong>Technologies</strong> environment, each page request that hits<br />

<strong>Microsoft</strong> Internet Information Services (IIS) is h<strong>and</strong>ed over to the ASP.NET HTTP<br />

pipeline. The HTTP pipeline is a chain of managed objects that sequentially processes<br />

the request <strong>and</strong> makes the transition from a URL to plain HTML text.<br />

At installation time, the SharePointH<strong>and</strong>lerFactory registers itself as the IHttp-<br />

H<strong>and</strong>ler for all .aspx requests. This association between types of resources <strong>and</strong> types<br />

of h<strong>and</strong>lers is stored in the configuration file of the SharePoint site. More exactly, the<br />

default set of mappings is defined in the section of the Web.config<br />

file. The line below illustrates the code that defines the HTTP h<strong>and</strong>ler for .aspx<br />

resources once Windows SharePoint Services is installed.<br />

<br />

The SharePointH<strong>and</strong>lerFactory IHttpH<strong>and</strong>ler requires that all page requests are<br />

Web Part Pages, that is, that they derive from the <strong>Microsoft</strong>.SharePoint.WebPartPages.<br />

WebPartPage class. The line below shows the @Page directive that ensures that<br />

the Web page is a Web Part Page.<br />

<br />

If the @Page directive is missing, it defaults to a Web Part Page type <strong>and</strong> the<br />

request is passed to the Web Part infrastructure for rendering. Any requests whose<br />

@Page directives identify Web Part Page types are also passed to the Web Part<br />

infrastructure. If an @Page directive identifies a page that is not a Web Part Page, the<br />

following error is returned: “To run as a WebPartPage, this page must derive from<br />

a class which is derived from the <strong>Microsoft</strong>.SharePoint.WebPartPages.WebPartPage<br />

object.”<br />

Once the request is passed to the Web Part infrastructure, Windows SharePoint<br />

Services determines whether the page is ghosted or unghosted. For ghosted pages,<br />

the request is h<strong>and</strong>ed off to the ASP.NET infrastructure for rendering; otherwise, the

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!