R – Conditional Display in ASPX Pages on Sharepoint

asp.netsharepoint

I wonder what the best practice for this scenario is:

I have a Sharepoint Site (MOSS2007) with an ASPX Page on it. However, I cannot use any inline source and stuff like Event handlers do not work, because Sharepoint does not allow Server Side Script on ASPX Pages per default.

Two solutions:

  1. Change the PageParserPath in web.config as per this site

    <PageParserPaths>
    <PageParserPath VirtualPath="/pages/test.aspx" 
            CompilationMode="Always" AllowServerSideScript="true" />
    </PageParserPaths>
    
  2. Create all the controls and Wire them up to Events in the .CS File, thus completely eliminating some of the benefits of ASP.net

I wonder, what the best practice would be? Number one looks like it's the correct choice, but changing the web.config is something I want to use sparingly whenever possible.

Best Answer

So in that case I would wrap it up in a feature and deploy it via a solution. This way I think you will avoid the issue you are seeing. This is especially useful if you plan to use this functionality within other sites too.

You can also embed web parts directly in the page, much like you do a WebControl, thereby avoiding any gallery clutter.

Related Topic