N2CMS

Changes to web.config

Note: The configuration has changed significantly. You can still use the castle windsor configuration but there is a preferred approach. Look in the example solution.

To set up N2 in an existing environment requires a few changes to web.config. Depending on what features you need not all of these are required. (taken from the binary release):

configuration / configSections / section

N2 uses castle windsor container for for dependency injection and component registration. This is set up in the castle configuration section which should be defined in this way.

 

configuration / connectionStrings

The web.config in the binary release contains a few examples of connection strings to common databases. If you already have a connection string whose name you don't want to change you will have to change "connection string name property" in the castle configuration section (nhSettings below). Dont forget to create a database and configure the connection string.

 

configuration / castle

This is where the components of N2 are configured. The first part (<properties>...) are required configuration properties. The nhSettings section is collapsed and displayed further down. The second part (<include uri...) includes the default component configuration from the N2 assembly. Any optional changes to the N2 components are made below that. These are some connection string extracts related to database flavour.

 

configuration / castle / properties / nhSettings

This is the expanded nhSettings section from the part above. The provided config example includes a few examples for different databases.

 

configuration / system.web / pages / controls

The controls section configure web controls that can be used with N2, e.g. the Zone control. 

 

configuration / system.web / httpModules 

The initializer module starts the n2 engine. At startup n2 investigates the executing app domain to find out about the content model. 

 

configuration / system.web / siteMaps / providers

The PublicSiteMap privder can be used to create a menu to visitors of the site. EditSiteMap and FileSiteMap are needed by the edit mode.

 

configuration / system.web / compilation / expressionBuilders

These expression builders can be used to simplify binding to content data in templates. This is exemplified in the template development documentation.

 

configuration / system.web / authentication

As long as you're local administrator you can use <authentication mode="Windows" />. When deploying the site you could set up the membership providers included in asp.net 2.0. The group names recognized by N2 are Editors and Administrators. Additionally any user with the name Admin will be granted full access. For quick and dirty authentication you can add an authentication section like this (just make sure to change the password).