Home

Configuration

Several configuration settings are available for Vici MVC. Most of them can be set from web.config and from the application's Init() method.

To set a configuration option in web.config, you add a key/value pair to the <appSettings> section. The name of the key is "Mvc" followed by a dot and the name of a configuration option (for example "Mvc.TemplatePath")

Example web.config:

<appSettings>
    <add key="Mvc.ApplicationClass" value="Demo.Mvc.Application, WebApp.Demo.Mvc" />
    <add key="Mvc.DefaultLayout" value="masterlayout" />
    <add key="Mvc.TemplatePath" value="content/templates" />
</appSettings>

The "Mvc.ApplicationClass" entry is required. It specifies which class holds the Init() method for your application.

Setting a configuration option from the application's Init() method is done by accessing properties of the static WebAppConfig class.

For example:

public static void Init()
{
    WebAppConfig.DefaultLayout = "masterlayout";
    WebAppConfig.TemplatePath = "content/templates";
}

Configuration variables

ApplicationClass

The ApplicationClass value can only be set from web.config. It tells Vici MVC where the Init() method is declared for initializing your application. It should be a full type name including the assembly name. The format is "Namespace.ClassName, AssemblyName".

DefaultLayout

The name of the default layout file (master template), without extension

TemplatePath

The relative (virtual) path of the directory where all your templates (views) will be located

DefaultLanguage

The ISO code of the default language of the website (for example "en", "fr", "nl", ...)

UseLanguagePath

Set to true to allow URLs of the form "http://www.vicimvcdemo.com/language/rest/of/url" to select the language of the site, for example: "http://www.vicimvcdemo.com/en/products/overview"