65.9K
CodeProject is changing. Read more.
Home

Allowing Inline C# Code in MOSS2007 Master Pages

emptyStarIconemptyStarIconemptyStarIconemptyStarIconemptyStarIcon

0/5 (0 vote)

Jul 12, 2010

CPOL
viewsIcon

12663

Does not do anything amazing but does show you can use the SharePoint object model in your inline code. If you saved the master page now and opened the site in your browser you’d get an error about not being able to run code blocks. There’s an extra line you need to put into your web.config file first to allow this inline C# to execute.
<PageParserPaths> 
<PageParserPath VirtualPath="/_catalogs/masterpage/*" CompilationMode="Always" AllowServerSideScript="true" IncludeSubFolders="true" /> 
</PageParserPaths>