If you are using inline server-side code (that is via a script tag inside your html form – not using Code behind), and you get this error when you try to run this file, there is a very simple fix.

All you need to do is find the Sharepoint section of your web.config file. Inside this section, I found a ‘SafeMode’ section. Then, in that section, there should be a ‘PageParserPaths’ section. For each file you are using inline code, you should have an entry similar to this:

  <PageParserPath VirtualPath="/YourRELATIVEPathAndFileName.aspx" 
  CompilationMode="Always" AllowServerSideScript="true" /> 

Naturally, also, for each file you enter, replace ‘YourPathAndFileName’ with the path/filename you are using.