I added an application page to my module and now I want to covert it to a web part page. In the code behind I changed the inheritance to WebPartPage.

using System;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;

namespace Certco.SRPWebPart.Layouts.Certco.SRPWebPart
public partial class SRPMain : WebPartPage
    protected void Page_Load(object sender, EventArgs e)

I also changed the page code to:

<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"   Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=, Culture=neutral,   PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SRPMain.aspx.cs" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage , Microsoft.Sharepoint, Version=,Culture=neutral, PublicKeyToken=71e9bce111e9429c" MasterPageFile="~masterurl/default.master" %>

<asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">


<asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">

I receive this error when running the page: Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Unknown server tag 'WebPartPages:WebPartZone'.

Source Error:

Line 17: Line 18: Line 19: Line 20: Line 21:

What am I missing?

  • Please mark it as answer, if my suggested solution has helped you. – Falak Mahmood Jun 25 '12 at 13:02

Register the tagprefix WebPartPages and try again:

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

Remove the CodeBehind attibute, instead add server side script directly on the Aspx page using Script for example:

<%@ Page language="C#" MasterPageFile="~/_layouts/v4.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=,Culture=neutral,PublicKeyToken=71e9bce111e9429c"%>

<script runat="server">
    // The following variables are visible to all procedures 
    // within the <script> block.
    String str;
    int i;
    int i2;

    int DoubleIt(int inpt)
        // The following variable is visible only within 
        // the DoubleIt procedure.
        int factor = 2;

        return inpt * factor;
  • Now I receive this error: – Walter Johnson Jun 12 '12 at 22:24
  • Compiler Error Message: CS0433: The type 'Microsoft.SharePoint.WebPartPages.WebPartPage' exists in both 'c:\Windows\assembly\GAC_MSIL\Microsoft.SharePoint\\Microsoft.SharePoint.dll' and 'c:\Windows\assembly\GAC_MSIL\Certco.SRPWebPart\\Certco.SRPWebPart.dll' Source Error: Line 139: Line 140: [System.Runtime.CompilerServices.CompilerGlobalScopeAttribute()] Line 141: public class SRPMAIN_ASPX__554292766 : global::Microsoft.SharePoint.WebPartPages.WebPartPage, System.Web.IHttpHandler { Line 142: Line 143: – Walter Johnson Jun 12 '12 at 22:24
  • The reason I did not use the "/layouts/v4.master" is because I received this error before: The referenced file '/_layouts/v4.master' is not allowed on this page. – Walter Johnson Jun 12 '12 at 22:33
  • have you tried resetting the IIS? – Falak Mahmood Jun 12 '12 at 22:35
  • As in stopping and starting the IIS? – Walter Johnson Jun 12 '12 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.