Try our conversational search powered by Generative AI!

Exclude routing of content pages


I'm sure this has been talked about before, but I've had no luck finding a satisfactory answer.

What I need to do is to prevent EPI from touching my content pages - I have the following:

webpage/containerpage/contentpage where webpage/containerpage/ is an epi page but the contentpages are not, which means I get 404 on all contentpages...

What is the best/easiest way to prevent this from happening?


Apr 11, 2018 18:29

Off the top of my head these content pages are MCV Controllers you can

  1. Create an InitializationModule
  2. Use the RouteTable to add a route through to your non episerver controllers (

Example (Untested) to route these page request to a Content page controller

    public class ContentPageRoutingInitializationModule : IInitializableModule
        /// <summary>
        /// Initializes this instance.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <remarks>Gets called as part of the EPiServer Framework initialization sequence. Note that it will be called
        /// only once per AppDomain, unless the method throws an exception. If an exception is thrown, the initialization
        /// method will be called repeadetly for each request reaching the site until the method succeeds.</remarks>
        public void Initialize(InitializationEngine context)

        /// <summary>
        /// Maps the routes.
        /// </summary>
        /// <param name="routes">The routes.</param>
        private static void MapRoutes(RouteCollection routes)
                "cotent-pages",                                           // Route name
                "webpage/containerpage/{page}",                           // URL with parameters
                new { controller = "Content", action = "Index" }  // Parameter defaults

        /// <summary>
        /// Resets the module into an uninitialized state.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <remarks><para>
        /// This method is usually not called when running under a web application since the web app may be shut down very
        /// abruptly, but your module should still implement it properly since it will make integration and unit testing
        /// much simpler.
        /// </para>
        /// <para>
        /// Any work done by <see cref="M:EPiServer.Framework.IInitializableModule.Initialize(EPiServer.Framework.Initialization.InitializationEngine)" /> as well as any code executing on <see cref="E:EPiServer.Framework.Initialization.InitializationEngine.InitComplete" /> should be reversed.
        /// </para></remarks>
        public void Uninitialize(InitializationEngine context) { /*uninitialize*/}

        /// <summary>
        /// Preloads the specified parameters.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        public void Preload(string[] parameters) { }


[Pasting files is not allowed]

Edited, Apr 12, 2018 9:50

Thanks, I'll see what I can come up with.

Apr 12, 2018 15:33

Have a look at this (if I understand your question correctly)

Apr 12, 2018 16:36
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.