ASP.NET MVC 2 Areas 404

Posted by Justin on Stack Overflow See other posts from Stack Overflow or by Justin
Published on 2010-06-10T04:11:25Z Indexed on 2010/06/10 4:23 UTC
Read the original article Hit count: 433

Filed under:
|

Hey,

Has anyone been able to get the Areas in ASP.NET MVC 2 to work?

I created a new Area called "Secure" and placed a new controller in it named HomeController. I then Created a new Home/Index.aspx view. However, when I browse to http://localhost/myapp/Secure/ it gives a 404 resource cannot be found. http://localhost/myapp/Secure/Home gives the same error.

My area registration looks like this:

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

I also tried this:

public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "Secure_default",
                "Secure/{controller}/{action}/{id}",
                new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }

Thanks, Justin

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about asp.net-mvc-2