valdisiljuconoks / MvcAreasForEPiServer

Add Asp.Net Mvc areas support for EPiServer
MIT License
5 stars 4 forks source link

Asp.Net Mvc Areas for EPiServer

Add Asp.Net Mvc areas support for EPiServer project

Getting Started

PM> Install-Package MvcAreasForEPiServer

After you installed this NuGet package, you will need to kick off area registration (usually this could be done in Global.asax.cs)

namespace MyProject
{
    public class Global : HttpApplication
    {
        protected void Application_Start()
        {
            AreaConfiguration.RegisterAllAreas();
        }
    }
}

By default configuration setting to detect Mvc Area by controller will be enabled.

Configuration

If you want to disable Mvc Area detection by controller, you can choose configuration settings to customize this behavior during areas registration procedure.

[InitializableModule]
[ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
public class ConfigureAreasSupportModule : IInitializableModule
{
    public void Initialize(InitializationEngine context)
    {
        AreaConfiguration.RegisterAllAreas(config =>
        {
            config.EnableAreaDetectionByController = true;
            config.EnableAreaDetectionBySite = true;
        });
    }

    public void Uninitialize(InitializationEngine context)
    {
    }
}

There are two configuration settings:

More info

General description
How to use Mvc Areas as EPiServer's site discriminators
Asp.Net Mvc Area support in EPiServer - part 2