PerformancePoint error: “Code blocks are not allowed in this file.”

PerformancePoint error: “Code blocks are not allowed in this file.”

While creating a new BI Center at my company we had no trouble building the site in dev, creating dashboards, Excel reports, etc.  Everything worked fine.  We were rolling the solution out to production (keeping in  mind, our dev and prod installations of SharePoint 2010 were created identically), but when we clicked on “Start Using PerformancePoint Services”, we were met with the error page and the message

An error occurred during the processing of /<BI Center>/Pages/ppssample.aspx.  Code blocks are not allowed in this file.

I started researching what could cause this, and saw numerous posts talking about modifying web.config.  Tried them all and got nowhere.  On top of that, I have a real hard time with just modifying web.config on a production system to fix a problem on a single site.  Fortunately, thanks to the @Statera contractors assisting us with the installation, we came across this TechNet article explaining how to fix this that made a LOT more sense.

Basically, you need to open the affected BI site in SharePoint Designer.  Click All Files under Navigation on the left, then in the pane to the right open the Pages folder and click on ppssample.aspx to open it.  When prompted to check out the file, check it out.  Locate the JavaScript function near the top called OpenDD() and edit the following two lines:

var siteCollection = "<%=SPHttpUtility.UrlPathEncode(siteCol.Value,false,true)%>";
var siteLocation = "<%=SPHttpUtility.UrlPathEncode(site.Value,false,true)%>";

And change them to this:

var siteCollection = "/";
var siteLocation = "/<path to BI Center parent site>/<BI Center site name>/";

So if your bi center is located at http://server/sites/site/bicenter, var siteLocation should look like this:

var siteLocation = "/site/bicenter/";

Save the file and publish a Major version. You should now be able to click on “Start Using PerformancePoint Services” and run Dashboard Designer.

Hope this helps!

27 thoughts on “PerformancePoint error: “Code blocks are not allowed in this file.”

    1. Make sure the URL for var sitecollection looks just like “/site/bicenter/”, no http or https, leave the ending “/”. Also make sure it’s not just saved, but a Major version is published, and it’s not checked out. If it’s still throwing an error what error are you getting? Also check the ULS to see if there’s more information as to what’s going on when the error occurs. Feel free to post the error here.

    1. Are you a Site Collection Admin or Farm Admin at your location? If not you’ll either need to have someone elevate your permissions or have one of the Farm Admins perform the change. That would be my first guess.

      1. I spoke a little too soon. I did manage to edit the file and it displays the Business Intelligence launch screen, but when I click on Run Dashboard designer, I get a “file not found” error. When I look at the url it reads:

        http://overallsitecollection/teamsite/bisite

        but it should read this:
        https://overallsitecollection/sitecollection/teamsite/bisite

        I’ve been playing around with the syntax of the ppsample file, but not successful yet. Any thoughts?

        1. I’m wondering if you need to change your ppssample.aspx code to look like this:
          var siteCollection = “http://overallsitecollection/sitecollection”;
          var siteLocation = “/teamsite/bisite/”;

          Maybe because your structure has a parent and child site collection, it needs to be broken down this way?

  1. Very Nice. I like this option much better than modifying the web.config to allow server side code if you do not need it.

  2. BAM!!!! Turns out I don’t need server admin privileges. Not sure why it wouldn’t let me edit the page before, but I tried again and it did, and this worked like a charm. Great info, thanks for putting this out there.

    Still would be interested to hear about any thoughts with respect to my question, but, hardly a priority.

    Thanks again, really, REALLY helpful.

    1. And one final “disregard”…I read the TechNet article, and saw this:

      Summary: When site administrators modify the PerformancePoint site template, it affects the underlying master page in SharePoint Server 2010 and enables server-side scripting.

      So, obviously, our site admins must have needed to modify the template. So, in the end, I learned not just how to fix the problem, but a little bit more about SharePoint. Which makes this good stuff all around 🙂

  3. So here’s a bummer…I don’t have server admin privileges. Site admin, yes, but not server – so I can’t edit the .aspx or master pages.

    Which forces me to raise the question – why wouldn’t Microsoft code BI sites so that they figure out what those parameter values need to be, based on the parent site path, or modify the “variable” values in each of the parameters so that Performance Point services worked right out of the box? This really seems like you have to go in and fix something that is broken when it ships.

  4. This works like a charm. After looking in to this issue, I almost given up as all suggested to modify either master css file of web.config file. Both option not available for me.

    Than I found this article. Thanks you so so so much…

  5. Incredible. Our client blocks us from server-side access so this was a god-send. Cheers to you!

    1. Hm. Do you know why I would receive a http 400 bad request error after clicking on the button to run dashboard designer?

      1. Take a look at your ULS logs while trying to run Dashboard Designer. It might have something to do with the construction of the site location variable in the ppssample file? I know the last “/” has to be there because of the way it dynamically creates the URL while loading Dashboard Designer…

        1. We also ran into file not found errors in our environment. The fix is in how the siteCollection and siteLocation variables are set. In our case, we were in a web app using managed paths. To make this work for a BI Center in the root site collection of the web app, we used:
          var siteCollection = “/”;
          var siteLocation = “/bicenter/”;

          To make this work for a BI Center that wasn’t in the root site collection we used:
          var siteCollection = “/sites/foo/”;
          var siteLocation = “/sites/foo/bicenter/”;
          where sites is our managed path, foo is our non-root site collection, and bicenter is a subsite of foo.

          All of that worked without needing to modify the web configs.

Comments are closed.

Comments are closed.