SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have ported a SP site from a dev server to a live server, as may be seen in other questions, and have another problem.

I have 1 page which uses some server side code to run. On dev it works, on live I get the error:

Code blocks are not allowed in this file.

Now from previous experience with this I know that it has to do with the PageParserPaths which is the same on the dev and live server. I have used the line:

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

Now the problem, I believe, is down to the fact that the web.config and the Sharepoint TestSite are on different ports. I.e. The Central Admin is located at http://server:29110/default.aspx and the TestSite is located at http://server/TestSite/default.aspx. So the web.config file is located in VirtualDirectories/21190

I may be getting completely confused about the different web.config files and this whole situation but I just need advice on where to look from here.

share|improve this question
up vote 3 down vote accepted

Please change your web.config file from:

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

to this:

<PageParserPath VirtualPath="~/TestSite/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true"/>

hope this help u..:)

share|improve this answer
What web.config file should I be changing?! If I change the one in the 21190 directory, nothing changes, if I add it to the one in the 80 directory I get the message, "An unexpected error has occurred." – anothershrubery Nov 23 '11 at 14:20
Ok, adding them to the web.config in the 80 directory was the solution. The unexpected error was that I didn't have the correct ODBC driver installed. Now I've another problem but that's for another question! – anothershrubery Nov 24 '11 at 10:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.