none
Problem with PDP page created in Visual Studio 2010 RRS feed

  • Question

  • Hello;

    I've got the following problem:

    - I created PDP page in VS 2010, SHP 2010 Empty Project

    - I added aspx page to the list of PDP pages

    - I added dll into the assembly and bin of PWA folder

    - I rised trust level of application folder to 'full'

    - I added the following entry into the web.config of PWA:

    <

     

    SafeControls

    >

     

    <

     

    SafeControl Assembly="SharePointProject9, Version=1.0.0.0, Culture=neutral, PublicKeyToken=304afbc854449857" Namespace="SharePointProject9.Layouts.SharePointProject9.WorkflowInitiationForm1" TypeName="*" Safe="True" SafeAgainstScript="True" AllowRemoteDesigner="True"

    />

     

    </

     

    SafeControls

    >

    and when I try to launch the page, I get the follwing error:

     

    Server Error in '/' Application.

    Parser Error

    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: The base type 'SharePointProject9.Layouts.SharePointProject9.WorkflowInitiationForm1' is not allowed for this page. The type is not registered as safe.

    Source Error:

    Line 7: <%@ Register Tagprefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
    Line 8: 
    Line 9: <%@ Page Language="C#" MasterPageFile="~masterurl/default.master" Inherits="SharePointProject9.Layouts.SharePointProject9.WorkflowInitiationForm1" 
    Line 10:   CodeBehind="WorkflowInitiationForm1.aspx.cs" meta:progid="SharePoint.WebPartPage.Document"
    Line 11:   %>


    Source File: /PWA/Project Detail Pages/WorkflowInitiationForm1.aspx Line: 9


    Version Information: Microsoft .NET Framework Version:2.0.50727.5446; ASP.NET Version:2.0.50727.5420

    what am I missing?

    Regards


    Bartosz
    Friday, July 8, 2011 1:47 PM

Answers

  • OK, here's the solution.

     Assume, that empty sharepoint 2010 project is created, and You have registered SafeControl in Web.config file. We’ll handle event of clicking ‘Cancel’ button.

    the steps are as follows:

    a. You create new workflow initiation form (Add/new item/Workflow initiation form/WorkflowInitiationForm2.aspx)

    b. You remove from aspx file the following code:

    OnClick="StartWorkflow_Click" OnClick="Cancel_Click"

    c. Open WorkflowInitiationForm2.aspx.cs file, and in order to handle clicking on cancel button, add the following code:

            protected Button B1;

     

            protected override void OnInit(EventArgs e)

            {

                B1.Click += new EventHandler(Cancel_Click);

            }

           

    d. In Sharepoint Web Designer, in folder Project Detail Pages create new aspx page

    e. Edit file

    f. Select Style/attach/default.master

    g. Copy at the end of newly created file content of WorkflowInitiaitionForm2.aspx

    h. Replace

    <%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>

     

    with

     

    <%@ Assembly Name="SharePointProject10, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0eab9ff233b52923" %>

    i. replace

    DynamicMasterPageFile="~masterurl/default.master"

    with

    masterpagefile="../_catalogs/masterpage/default.master"

     

    j. remove  AutoEventWireup="true"

     

     

    k. change

    <asp:Button ID="Cancel" runat="server" Text="Cancel" />

    with

    <asp:Button ID="B1" runat="server" Text="Cancel" />

     

    l. remove

    <%@ Page Language="C#" masterpagefile="../_catalogs/masterpage/default.master" title="Untitled 4" inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" meta:webpartpageexpansion="full" meta:progid="SharePoint.WebPartPage.Document" %>

     

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

     

    That’s all. Don’t forget to place appropriate dll in the bin folder.

    It’s working!


    Bartosz
    • Marked as answer by DIMMI5 Monday, July 25, 2011 5:38 PM
    Monday, July 11, 2011 2:03 PM

All replies

  • Hi,

    Can I ask is there something special you are doing on the PDP page that necessitated you having to code one from scratch? PDP's are straight web part pages and there is a substantial number of them provided oob.


    Alex Burton
    www.epmsource.com | Twitter
    Project Server TechCenter | Project Developer Center | Project Server Help | Project Product Page
    Saturday, July 9, 2011 12:46 PM
    Moderator
  • Did you Register the assembly (SharePointProject9.Layouts.SharePointProject9.WorkflowInitiationForm1) as a safe control in the Web.config file

    Sample

      1: <SafeControl Assembly="XYZ.DemoParts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f03e5f7a44d50a3b" 
      2:       Namespace="xyz.WebParts" 
      3:       TypeName="*" 
      4:       Safe="True" 
      5:       AllowRemoteDesigner="True" />


    Read about this:
    http://grounding.co.za/blogs/brett/archive/2008/05/23/sharepoint-register-an-assembly-as-a-safe-control-in-the-web-config-file.aspx


    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82
    Monday, July 11, 2011 8:55 AM
  • Hello, Alexander;

     

    that need results from requirements of customer, who expects a specific functionality. It may be obtained only by extended functionality of additional Web Parts or direct implementation of asp pages.

     

    Regards


    Bartosz
    Monday, July 11, 2011 10:30 AM
  • Amit;

     

    thank You for this information. I placed all needed taks in web.config, but I made a mistake in naming. Now the error I obtain is as follows:

     

    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: The event handler 'OnClick' is not allowed in this page.

    Source Error:

    Line 12: 
    Line 13: <asp:Content ID="Main" ContentPlaceHolderID="PlaceHolderMain" runat="server">
    Line 14:   &nbsp;&nbsp;&nbsp;&nbsp;<asp:Button ID="StartWorkflow" runat="server" OnClick="StartWorkflow_Click" Text="Start Workflow"/>&nbsp;&nbsp;<asp:Button ID="Cancel" runat="server" OnClick="Cancel_Click" Text="Cancel"/>
    Line 15: </asp:Content>
    Line 16: 

    Source File: /PWA/Project Detail Pages/WorkflowInitiationForm1.aspx    Line: 14


    Version Information: Microsoft .NET Framework Version:2.0.50727.5446; ASP.NET Version:2.0.50727.5420

    Server Error in '/' Application.

    Parser Error

     


    Bartosz
    Monday, July 11, 2011 10:32 AM
  • Hello Bartosz,

    Did you create a sharepoint designer page?  When you create .aspx pages in SharePoint desinger the .aspx page is stored in the content database. By design you cannot execute server side code inline code inside these pages as SharePoints Safe Mode parser will block any code from being executed. You might need to relook at the design of the page. You will probably need to add your OnClick event handler as a delegate to the Click event on the link in your codebehind and remove the OnClick attribute in your .aspx page.


    Thanks, Amit Khare |EPM Consultant| Blog: http://amitkhare82.blogspot.com http://www.linkedin.com/in/amitkhare82
    Monday, July 11, 2011 11:19 AM
  • OK, here's the solution.

     Assume, that empty sharepoint 2010 project is created, and You have registered SafeControl in Web.config file. We’ll handle event of clicking ‘Cancel’ button.

    the steps are as follows:

    a. You create new workflow initiation form (Add/new item/Workflow initiation form/WorkflowInitiationForm2.aspx)

    b. You remove from aspx file the following code:

    OnClick="StartWorkflow_Click" OnClick="Cancel_Click"

    c. Open WorkflowInitiationForm2.aspx.cs file, and in order to handle clicking on cancel button, add the following code:

            protected Button B1;

     

            protected override void OnInit(EventArgs e)

            {

                B1.Click += new EventHandler(Cancel_Click);

            }

           

    d. In Sharepoint Web Designer, in folder Project Detail Pages create new aspx page

    e. Edit file

    f. Select Style/attach/default.master

    g. Copy at the end of newly created file content of WorkflowInitiaitionForm2.aspx

    h. Replace

    <%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>

     

    with

     

    <%@ Assembly Name="SharePointProject10, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0eab9ff233b52923" %>

    i. replace

    DynamicMasterPageFile="~masterurl/default.master"

    with

    masterpagefile="../_catalogs/masterpage/default.master"

     

    j. remove  AutoEventWireup="true"

     

     

    k. change

    <asp:Button ID="Cancel" runat="server" Text="Cancel" />

    with

    <asp:Button ID="B1" runat="server" Text="Cancel" />

     

    l. remove

    <%@ Page Language="C#" masterpagefile="../_catalogs/masterpage/default.master" title="Untitled 4" inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" meta:webpartpageexpansion="full" meta:progid="SharePoint.WebPartPage.Document" %>

     

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

     

    That’s all. Don’t forget to place appropriate dll in the bin folder.

    It’s working!


    Bartosz
    • Marked as answer by DIMMI5 Monday, July 25, 2011 5:38 PM
    Monday, July 11, 2011 2:03 PM