Customized settings in web.config files per eSpace using Factory Configuration

Customized settings in web.config files per eSpace using Factory Configuration

  • You want to define custom settings in the web.config file that vary from application to application (e.g. you want custom error handlers for HTTP error codes, that vary for each eSpace);
  • You are running the OutSystems Platform 4.1 for .NET;

How to do it?

You could simply change the web.config after republishing the application, but that would not be very useful because web.config is rewritten everytime you publish a new eSpace version, so you would have to manually change the web.config everytime a new version of your application is deployed.

Using Factory Configuration

The right way to do it is by using the Service Center Factory Configuration ( You will need to deploy this solution, and configure the settings for it.
This application uses XSLT to make changes to the default web.config file, so you will need some insight on how to write XSLT. You will also need to check the default web.config file - you can simply navigate to the Hub Server folder and copy the web.config that is deployed by default for that eSpace.

You can also use some of the predefined templates to have an idea of how things can be done.

Creating rules

After deploying Factory Configuration, simply access http://server/FactoryConfiguration, login (using Service Center credentials) and navigate to Shared Configurations. Here, you can create a new shared configuration, and either use one of the templates or create a configuration from scratch. After creating your XLST rule, you simply need to navigate to eSpace and associate your configuration(s) to the eSpace(s) you wish to see associated with them. Afterwards, you need to republish the eSpaces so the changes become effective.


Below there is an example that redirects all requests to non-existent aspx pages to the Service Center Login page:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="">

<xsl:output method="xml" indent="yes" encoding="UTF-8"/>

<xsl:template match="@*|node()">
<xsl:apply-templates select="@*|node()"/>

<xsl:template match="/configuration/system.web/customErrors/error">
<xsl:attribute name="statusCode">404</xsl:attribute>
<xsl:attribute name="redirect">/ServiceCenter/Login.aspx</xsl:attribute>

Is this still a valid way of doing things in version 8? Is this supported in version 9?


Hi Justin,

In V8 definetly yes. On P9 I haven't tested yet.

Yes it is.

We created a partial encrypted web.config in this way with P9 Amsterdam
Important information this one. Still valid then? Thanks for the tip.

Joost > I remember you were looking for a way to encrypt web.config. I know where to look if I need help...
Hi guys,

Is it possible using this to change the session time-out of the web.config file, in order to achieve a custom configuration different from the default value of the session time-out on the application server?


Hi Miguel,

Yes, you can use it to change the session timeout.

(As alternative you also have the BrowserSession component in the forge that allows you to just change the value in runtime)


João Rosado