Summary

The Web.config file contains many configuration settings for your mojoPortal content management system installation.

Most of the settings that you will be interested in are located in the appSettings section which looks like this:

<appSettings file="user.config">
    <add key="MSSQLConnectionString" value="server=(local);UID=mojouser;PWD=mojo123;database=mojoportal" />

    ...lots of settings

</appSettings>

The database connection string is the first setting you'll become aware of and will need to configure correctly to get mojoPortal working. Most of the settings have comments in the Web.config file explaining their use.

Using a user.config File to Make Upgrades Easier

You'll notice above there is an attribute on the appSettings element named file, and it has the value user.config What that attribute does is tell the ASP.NET runtime to look first in the file specified for all settings in the appSettings section. So you can put your connection string in the user.config file and then it won't be overwritten when you next upgrade your installation of mojoPortal. The connection string in user.config will override or trump the one in Web.config. So essentially the appSettings in Web.config can be defaults and you can leave them as they are and put all your customization in user.config so that they don't get overwritten by the new Web.config file during upgrades. There is no user.config file included with mojoPortal, but there is a file named user.config.sample in the root of the web which can be renamed to user.config then edited with your custom settings.

Often there are new settings in Web.config for new versions of mojoPortal CMS so it is important to always use the new Web.config file so that you get any new settings. Using a user.config can make this less painful because you don't have to keep restoring all the custom settings.

One final point. Don't get carried away and copy all the settings from the appSettings section into your user.config file. Only put things there where you are not using the default setting. Sometimes default settings change over time and you can end up with the wrong defaults if you put all the settings in user.config. Only put things in user.config that you are customizing for a good reason.

Touching web.config or Restarting the Application

There are a couple of reasons to "touch the web.config" file. One is to restart the website Application Pool and the other is to force changes to other configuration files, like the user.config, to be read.

The ASP.NET runtime monitors the Web.config file to detect when you make changes, but it does not monitor the user.config file. So, whenever you make a change in user.config you need to edit Web.config to make it pick up your changes in user.config. The easiest way to do this is to open the web.config, add a line to the bottom of it and then save the file. IIS will detect the change, restart the application which in turn reads the user.config.

Note: As of mojoPortal 2.9, you can use the "Restart Application" button in Administration > System Information to restart the application, which will force IIS to read the user.config again.

Created by Steve Mitchell on Apr 10, 2008
Last Modified by Joe Davis on Mar 16, 2023