Monday, February 16, 2009

How to add SharePoint aspx template to a document library?


SharePoint allows us to upload to a document library an aspx and html custom pages and view them as SharePoint page.
However, when we tried to upload a custom page with SharePoint master page (like~/_layouts/application.master) or code it didn't worked, and we got a "Configuration Error" page.

The solution:


1. Add the following to the custom page:

<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>

<%@ Register Tagprefix="WebPartPages"
Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint,
Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@
Register Tagprefix="OSRVWC" Namespace="Microsoft.Office.Server.WebControls"
Assembly="Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>

<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls"
Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>

<%@ Register Tagprefix="SEARCHWC"
Namespace="Microsoft.Office.Server.Search.WebControls" Assembly="Microsoft.Office.Server.Search,
Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

<%@
Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls"
Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>


2. Then open the web.config and replace the tab <PageParserPath/> with the following path:

<PageParserPath
VirtualPath="/sites/*" IncludeSubFolders="true" CompilationMode="Always"
AllowServerSideScript="true" />


See also : http://www.bluedoglimited.com/SharePointThoughts/ViewPost.aspx?ID=242


No comments:

Post a Comment