My little part of the Internet

Month: March 2008

ASP.Net and SharePoint

Its taken me long enough but finally had a reason to write some true ASP.Net code.  One problem I hit was that trying to run code on a server that is running SharePoint Services …. so you need this exceprt….
 You may see this error:

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

Reason:  SharePoint does not allow server side code to execute in aspx pages contained in the SharePoint site.
Fix:  Edit the web.config (I.E. C:InetpubwwwrootwssVirtualDirectories80web.config) file:

<PageParserPaths>
        <!– To allow a single file: –>
        <PageParserPath VirtualPath=”/test.aspx” CompilationMode=”Always” AllowServerSideScript=”true” />
        <!– To allow global: –>
        <PageParserPath VirtualPath=”/*” CompilationMode=”Always” AllowServerSideScript=”true” />
        <!– To allow global within a subsite: –>
        <PageParserPath VirtualPath=”/websitefoobar/*” CompilationMode=”Always” AllowServerSideScript=”true” />
</PageParserPaths>

© 2024 Kevsters Blog

Theme by Anders NorénUp ↑