Provisioning multiple pages with one source file
By Anatoly Mironov
I found an easy way to provision multiple pages. Create a module. Add an aspx.file (e.g. default.aspx). In the elements file define nodes for every page. Path should be the same for all pages, but the Url should be your destination page. The “default.aspx” (name doesn’t matter) can contain content, or just one @Page directive if Publishing feature is available:
<%@ Page Inherits="Microsoft.SharePoint.Publishing.TemplateRedirectionPage,Microsoft.SharePoint.Publishing,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
```In the Element.xml define all your pages: [![](https://sharepointkunskap.files.wordpress.com/2011/10/abunchofpages-elements.png "abunchofpages-elements")](https://sharepointkunskap.files.wordpress.com/2011/10/abunchofpages-elements.png) In every File node you can add webparts, here is an example:
<![CDATA[ Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c Microsoft.SharePoint.WebPartPages.ContentEditorWebPart About cars Test None true Lorem ipsum dolor sit amet ]]>
[![Inside Sharepoint](http://blogs.msdn.com/blogfiles/microsoft_press/WindowsLiveWriter/f9c5665456db_9212/9780735627468x_2.jpg)](http://www.amazon.com/Inside-Microsoft-SharePoint-2010-Pattison/dp/0735627460 "See the book on Amazon")It works fine to use our default.aspx with redirection directive (**TemplateRedirectionPage**):
<%@ Page Inherits=“Microsoft.SharePoint.Publishing.TemplateRedirectionPage, Microsoft.SharePoint.Publishing,Version=14.0.0.0, Culture=neutral,PublicKeyToken=71e9bce111e9429c” %>
System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.Publishing.TemplateRedirectionPage.ComputeRedirectionVirtualPath(TemplateRedirectionPage basePage) at Microsoft.SharePoint.Publishing.TemplateRedirectionPage.get_RedirectionUrl() at Microsoft.SharePoint.Publishing.TemplateRedirectionPage.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) 92f74450-a50b-416d-9b03-25ef15e3c845