Solved

Code blocks are not allowed in SharePoint 2013

Posted on 2013-11-25
6
1,329 Views
Last Modified: 2014-11-26
I have a inline server side code running in master pages and couple of aspx pages running in web root folder of SharePoint web application.
This is a sharepoint 2013 web application migrated from sharepoint 2010.
i had this working in sharepoint 2010 by adding the page parser value like this

<PageParserPath VirtualPath="/_catalogs/masterpage/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />

and selective pages addition in same page parser.

Now when i do the same addition in page parser it does not work in sharepoint 2013.

IF i modify the page parser with this entry it works
<PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />

which opens the whole pages for scripting and it is not acceptable in our environment.

i tried to run the scripting in the specific pages also but until i open the whole master-page folder it is not working

this does not works

<PageParserPath VirtualPath="/_catalogs/masterpage/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />      
        <PageParserPath VirtualPath="/CustomPages/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />
        <PageParserPath VirtualPath="/fillname.aspx" CompilationMode="Always" AllowServerSideScript="true" />

this works
<PageParserPath VirtualPath="/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />      
        <PageParserPath VirtualPath="/CustomPages/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" />
        <PageParserPath VirtualPath="/fillname.aspx" CompilationMode="Always" AllowServerSideScript="true" />

but this is not acceptable to open scripting in all pages.

I am kind of confused what is the new settings in SharePoint 2013. is there a way to run scripting in specific location only.

what will happen if we open scripting in the root file. isn't it in secured and open for scripting

any suggestions please...
0
Comment
Question by:kukdai
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 18

Expert Comment

by:Walter Curtis
ID: 39677844
This is not a suggested solution because you have probably run across this yourself, but I had the same problem in 2010 and this link help me solve the problem.

http://social.technet.microsoft.com/Forums/en-US/sharepointadminprevious/thread/10b9dce5-db29-48e3-be4a-102f5b54535b/


Good Luck
0
 
LVL 9

Author Comment

by:kukdai
ID: 39679147
Thanks for the comment,
but looks like you did not read it properly. this is not a 2010 web application it is 2013.
I know how it works in 2010 but the same way it is not working in 2013 and i don't know why.
adding page parser to specific page or to master page folders doesn't help in 2013 anymore unless you all scripting in all the pages inside your web application.
0
 
LVL 18

Expert Comment

by:Walter Curtis
ID: 39679222
Too bad it was not something that could help. I did read it correctly, and as I mentioned the solution for me was in a 2010 farm. But thought it was worth a few key strokes to try to help.

Hope you find your solution soon.
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Expert Comment

by:Alexander Sviridov
ID: 40316665
Problem in Microsoft.SharePoint.ApplicationRuntime.SPRequestModule.IsExcludedPath(string virtualPath) method. This method use static field SPRequestModule.s_excludedFileList. This field initiated in SPRequestModule.Init metod.
BUT method Microsoft.SharePoint.ApplicationRuntime.SafeModeConfigurationHandler.Create(), which use SPRequestModule.IsExcludedPath called before SPRequestModule.Init

1. create custom configuration handler class

public class MySafeModeConfigurationHandler : IConfigurationSectionHandler
    {
        public object Create(object parent, object configContext, XmlNode section)
        {
            var type = typeof(Microsoft.SharePoint.ApplicationRuntime.SPRequestModule);
            var field = type.GetField("s_excludedFileList", BindingFlags.Static | BindingFlags.NonPublic);
            object s_excludedFileList = field.GetValue(null);
            if (s_excludedFileList == null)
                field.SetValue(null, Activator.CreateInstance(field.FieldType));

            type = Type.GetType("Microsoft.SharePoint.ApplicationRuntime.SafeModeConfigurationHandler, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c");
            var method = type.GetMethod("Create");
               
            object o = Activator.CreateInstance(type);
            object result = method.Invoke(o, new object[]{parent, configContext, section});

            return result;
        }
    }
2. change web.config

      <!--section name="SafeMode" type="Microsoft.SharePoint.ApplicationRuntime.SafeModeConfigurationHandler, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /-->
      <section name="SafeMode" type="MyNamespace.MySafeModeConfigurationHandler, MyLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=fc475d95eb56414f" />
0
 
LVL 9

Accepted Solution

by:
kukdai earned 0 total points
ID: 40457357
I never got a good solutions for this problem.
0
 
LVL 9

Author Closing Comment

by:kukdai
ID: 40466448
I never got a good and appropriate solution for the problem..
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently came across an issue with a MOSS 2007 deployment where access into some sub-sites were denied, even for the MOSS farm administrators. A bit of background to the setup of this MOSS farm; this was a three server setup, consisting of a fr…
Summary In SharePoint 2010 it is easy to create custom color themes to jazz up a site. Theme colors can also be created in PowerPoint 2010 with a few clicks. But how do the chosen colors actually look in the SharePoint site? The attached PowerPoint…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question