Tuesday, January 19, 2010

Project Server 2010: Changing Master Page

Once I tried simply to change master page, just to change an image. First of all I found out the master page. Project Server 2010 uses v4.master master page for all application pages. When my changes were applied I uploaded back master page to the master page gallery. And I was surprised, now all PS pages showed me an error: “The base type 'Microsoft.Office.Project.PWA.PJBaseWebPartPage' is not allowed for this page. The type is not registered as safe”. I did rollback, but still got the same error.

It was fixed by adding the following line to the web.config:

<SafeControl Assembly="Microsoft.Office.Project.Server.PWA, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Project.PWA" TypeName="*" Safe="True" />

Atferwards, instead of getting the previous error I got the new one: “An error occurred during the processing of /PWA/default.aspx. Code blocks are not allowed in this file”. It happened because SharePoint disabled the ability to create the server-side scripts by default, so you had to turn it on. You are able to do that in the web.config file, in the configuration/SharePoint/PageParserPaths configuration section:

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

But new error appeared: “The control type 'Microsoft.Office.Project.PWA.CommonControls.PageProperty' is not allowed on this page. The type is not registered as safe.”

<SafeControl Assembly="Microsoft.Office.Project.Server.PWA, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Project.PWA.CommonControls" TypeName="*" Safe="True" />

Issue is finnaly fixed. Now you can apply any changes to the master page without getting errors.

22 comments:

  1. Thanks buddy, I used the same approach for fixing the Project Server 2007 when i modified the Master Page.

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. nao adiantou porra nenhuma esse artigo

      Delete
  2. Thanks! I got one other error when looking at a project detail page when clicking a project name in project center:

    The base type 'Microsoft.Office.Project.PWA.ApplicationPages.ProjectDrillDownPage' is not allowed for this page. The type is not registered as safe.

    I had to add this line to the web.config as well.

    SafeControl Assembly="Microsoft.Office.Project.Server.PWA.ApplicationPages, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Project.PWA.ApplicationPages" TypeName="*" Safe="True"

    ReplyDelete
    Replies
    1. Thank you for the information, I had the same problem!

      Delete
  3. This is fundamentally wrong. Think about it... the first web.config change would already need to exist if PWA was to work in the first place. I too have this same problem and the changes above had no affect. So I thought about it and decided to provision a new instance of PWA and guess what... It works fine. So the question still seems to be what is causing this issue and how can it the changes be rolled back so the site will function?

    Ken

    ReplyDelete
  4. We are taking about changing DEFAULT MASTER PAGE - v4.master. I suspect you won't be able to explain to your customer that you roll back the whole PWA site just because you've made some small change on the master page! :) Please refer to ProjectServer Team to solve such a "fundamental" issue, if our workaround is not "fundamentally right" enough.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. I have been stuck on this for days now. I also have the same error relating to "The base type 'Microsoft.Office.Project.PWA.ApplicationPages.ProjectDrillDownPage' is not allowed for this page. The type is not registered as safe." when I click on a project to bring up the project detail page. I have tried adding the following lines to C:\inetpub\wwwroot\wss\VirtualDirectories\80\web.config but no luck:

    SafeControl Assembly="Microsoft.Office.Project.Server.PWA, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Project.PWA" TypeName="*" Safe="True"

    and

    SafeControl Assembly="Microsoft.Office.Project.Server.PWA, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Project.PWA.ApplicationPages" TypeName="*" Safe="True"

    Do you have any other ideas? Everything else works fine!!

    ReplyDelete
  8. Hi!
    It looks you are adding incorrect assembly reference in your second line - you should use ...Version=14.0.0.0... but not Version=12.0.0.0. Hope this helps!

    ReplyDelete
  9. Thank You!

    This post saved my bacon. We made .master changes a few months ago but on reboot of the server changed all that and created this error.

    Thanks Again for this post.

    ReplyDelete
  10. Hello,
    I would like to change default layout of the PWA and put my layout but Microsoft is not allowing to change the pwa masterpage.Can you give me any idea by which i can do this? or it is not possible anyway?

    Thanks.
    Ashraf
    www.MrOffice365.Com

    ReplyDelete
  11. These safecontrols and pageparser path addition in web.config don't work in multi-server farm. I applied the above changes in standalone application on my personal and UAT environment but it doesn't work and crashed the other sharepoint applications which were using the same webconfig.

    ReplyDelete
  12. it smoothly works on standalone application, it crashes on multiserver farm!

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. I have noticed that I can also get rid of this error by setting the master page back to the original that came with PS2010 and then setting it back to the custom one. It's almost like the pages have to forced re-compiled by the server. I have to do this on each of the pages. From them on, the pages load fine. Does anyone have an explanation for this?

    ReplyDelete
  15. SafeControl Assembly="Microsoft.Office.Project.Server.PWA, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Project.PWA" TypeName="*" Safe="True"

    and

    SafeControl Assembly="Microsoft.Office.Project.Server.PWA, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.Office.Project.PWA.ApplicationPages" TypeName="*" Safe="True"

    but still i am getting error like:
    “An error occurred during the processing of /PWA/default.aspx. Code blocks are not allowed in this file”

    kindly help me

    ReplyDelete
  16. in the configuration/SharePoint/PageParserPaths configuration section is safe mode is required to put the code under safe mode tag

    ReplyDelete