Skip to content
Jamie E edited this page Oct 30, 2015 · 1 revision

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 customizations 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.

Important Note:

You need to be aware that 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. This can be just simply open the Web.config file type a space somewhere and save it.

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 customising for a good reason.