Limit controllers to specific area only

Posted by Andrej Kaurin on Stack Overflow See other posts from Stack Overflow or by Andrej Kaurin
Published on 2010-04-10T19:07:59Z Indexed on 2010/04/10 19:13 UTC
Read the original article Hit count: 530

Filed under:
|

I have one Area and in AreaRegistration I defined namespace all controllers in area belongs to.

context.MapRoute(
                "Admin_default",
                "Admin/{controller}/{action}/{id}",
                new { controller="Home", action = "Index", id = UrlParameter.Optional },
                new[] { "GotSolution.WebSite.Areas.Admin.Controllers" }             // Namespaces
            );

How to prevent controller in that area to be called even when not that route is matched. I.E. /home/index (without "admin" word at the beginning).

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about asp.net-mvc2