Showing posts with label Code blocks are not allowed in this file. Show all posts
Showing posts with label Code blocks are not allowed in this file. Show all posts

20 November, 2013

Code blocks are not allowed in this file + Performance Point

What is performance point service (PPS)?
PerformancePoint Services is a performance management service that you can use to monitor and analyze your business. By providing flexible, easy-to-use tools for building dashboards, scorecards, reports, and key performance indicators (KPIs), PerformancePoint Services can help everyone across an organization make informed business decisions that align with companywide objectives and strategy.

Functionality: Scorecards, dashboards, and KPIs help drive accountability. Integrated analytics help employees move quickly from monitoring information to analyzing it and, when appropriate, sharing it throughout the organization.

One of our users raised a ticket by mentioning “facing problem while using performance point service w.r.t. BI dashboards. Further probing reflected the fact that he was using site with BI template with PPS activated features.

So far so good but while opening the site i.e. PPSSample.aspx, he was getting the following error message-

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

Further checks provided more details that ppssample.aspx page is by-default one and not a customized. You will find this under every web application’s site collection. Previously I thought it might be web application specific but I was able to reproduce it across all web apps so it’s a farm wide issue.

One thing we need to understand that there is nothing wrong in your activated features or enabled performance point functionality. Also, not all the users use PPS functionality so you need to take the decision very carefully w.r.t. following troubleshooting.

Resolution:

(neat and simple)- 2 step resolution:
Placed this in the web.config file of the web application within the <PageParserPath> header.

1)   <PageParserPath VirtualPath="/BI/Pages/ppssample.aspx" CompilationMode="Always" AllowServerSideScript="true" />

2)   IISRESET

That’s it- Your issue will be resolved.

Note: I mentioned about decision (refer the underlined keyword) - here is the fact- Thanks to Justin Kobel’s article  who have stated- “the page parser solution both open up a huge security hole within the page (allowing server side code to be authored within SPD and executed within your page), as well as causing issues in a farm scenario (trying to keep all of your web.config’s in sync, causing recovery issues, etc.)

So the alternate solution which is little bit tricky and need SPD.
Here are the references:


If you have any queries/questions regarding the above mentioned information then please let me know. I would be more than happy to help you as well as resolves your issues, thank you.

Product applies to-
-SharePoint Server 2010
-SharePoint Foundation 2010
-SharePoint Server 2013
-SharePoint Foundation 2013

21 February, 2013

Code Blocks are not allowed in this file error in sharepoint 2010



Hello Everybody,
Today I worked on one critical issue which belongs to our development environment. We have migrated one web application from production environment to development for testing purpose. Migration has been successful but we were facing an exception while browsing the web application.

Error Message:
An error occurred during the processing.
Code blocks are not allowed
Troubleshoot issues with Microsoft SharePoint Foundation.

Server Configuration:
·         2 SharePoint Servers
·         SQL server 2008 R 2
·         Windows Server 2008 R2
·         SharePoint Version: SP2010

Troubleshooting done:
1.    Tried accessing the system pages i.e. settings.aspx, viewlsts.aspx etc. every system was opening fine without any issues. So the issue is with the home page only…
2.    Tried accessing the web part maintenance page, it opened without any issues. We closed the webparts which are present on the home page-just to make sure that there is no problem with the existing webparts. Checked the home page again but same issue.
3.    Tried changing the master page as were able to open the system pages (by appending _layouts/changesitemasterpage.aspx). We changed to different one as we are using custom master page. Checked the results again but same problem.
4.    Opened the site in SharePoint Designer 2010 and checked the status of master page as well as the home page. It was fine and without customization too.

Note: if you see any of these pages in customizable state then I would suggest you to take the backup and try ‘reset to site definition” option.

Obviously, next question will arise- what exactly it will do? Yes, it will reset your page to default state. It means you will lose your customizations. But issue will be resolved and you can customize the page again as per your requirements.

5.    Checked the windows application as well as SP logs (Location: \14\Logs). I would suggest you to analyze these logs before continuing your troubleshooting.

What is my observation\Understanding?
·         Code blocks are only processed for custom pages deployed in the root virtual directory of a site if the code it considered safe.
·         This code is considered safe only if the page is served directly from the file system. As soon as it becomes unghosted for any reason, the code is no longer considered safe and the error shown in the symptom occurs.

Resolution:
As our production web application was working without any issues so I compared the web.config of both the applications. Analyze the code line by line with the production web.config and that’s it. I found the one which was missing in the web.config that belongs to my development web application.

Note: I would suggest you to take a proper backup before making any changes in the web.config file.

What I did? What kind of entries I added in the web.config file?

Here we go:-
In you web.config, you need to search the tag name as “<PageParserPaths>”
Once you find that then make the following  entry:
<PageParserPaths>
    <PageParserPath VirtualPath="/apps/*" CompilationMode="Always"
              AllowServerSideScript="true" IncludeSubFolders="true" />
</PageParserPaths>
After adding this entry then IISRESET is mandatory.

Tried accessing the site and the issue has been resolved.

Happy SharePoint once again…

If you have any queries/questions regarding the above mentioned information then please let me know, Thank you.

16 November, 2011

Code blocks are not allowed in this file

One of my user has opened a ticket with my team by mentioning “He is not able to browse his SharePoint Team Site and getting the below mentioned error message.

Problem Description: Not able to browse the SharePoint site

Error Message: An error occurred during the processing of /site/My Documents/Forms/Alldocuments.aspx. Code blocks are not allowed in this file.
Here is my analysis regarding the same:
    1) Check the site settings page is opening or not.
   How to check that? - Site URL/_layouts/settings.aspx
   2) If you are using any specialized master page in your environment then make sure it is properly selected under the master page galleries
How to check that? – Site actions-site settings-Under look and feel-master page galleries
   3) Check the default.aspx page is existing or not
How to check that?

-Open your site, it’s quite obvious that you will get error message
-Be on that same page
-Control + O (from your keyboard)
-This will open the shared view of your site
-if you see the default.aspx page their then go ahead and take the backup of that page in the same location
-It wills create-default1.aspx—this is fine and we are on right track
-In this same shared location, you can see the created subsites i.e. the child sites which are created underneath
-Go to any of the subsite by means of shared drive and copy the default.aspx and paste it at the root location
-Try t browse the site and check the results
-Your site is up and running without any issuesJ

If you have any queries/questions then please let me know.
I would be more than HAPPY to help you as well as RESOLVES your issues, Thank youJ