use viewengine only within certain area

Posted by Daniel Powell on Stack Overflow See other posts from Stack Overflow or by Daniel Powell
Published on 2012-03-21T05:27:18Z Indexed on 2012/03/21 5:29 UTC
Read the original article Hit count: 259

Filed under:
|

Is it possible to use a custom view engine for a specific area only?

I have tried

  public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "Forms_default",
                "Forms/{client}/{controller}/{action}/{id}",
                new { client="Generic",action = "Index", id = UrlParameter.Optional }
            );

            ViewEngines.Engines.Clear();
            ViewEngines.Engines.Add(new ClientSpecificViewEngine());

        }

Within my area but this seems to be a site wide affect as I'm getting errors specific to the custom view engine when visiting pages outside the area.

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about viewengine