Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Code blocks are not allowed in SharePoint 2013

Posted on 2013-11-25
6
Medium Priority
?
1,412 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 20

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 20

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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

I used to be SharePoint evangelist in our company, so my Outlook always full of questions about how to do this, or where I can find that. One day I found such an email with the following question: "how to attach 3-State workflow (one of the workflow…
There is one common problem that all we SharePoint developers share: custom solution deployment. This topic can't be covered fully in this short article, so all I want to do in this one is to review it from a development-to-operations perspectiv…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

597 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