I can't get areas working in VS2010

Posted by devlife on Stack Overflow See other posts from Stack Overflow or by devlife
Published on 2010-05-01T17:46:50Z Indexed on 2010/05/01 17:57 UTC
Read the original article Hit count: 198

I just upgraded from VS2010 RC to RTM. Now my areas aren't working. I have a Profile area with a Home controller and an Action method Index().

If I try: http://localhost:4951/profile I get a 404 error saying that the resource can't be found. If I try http://localhost:4951/profile/home I get the same error. However, if I try http://localhost:4951/profile/home/index then the view is returned.

Here is my ProfileAreaRegistration:

public class ProfileAreaRegistration : AreaRegistration { public override string AreaName { get { return "Profile"; } }

    public override void RegisterArea(AreaRegistrationContext context)
    {
        context.MapRoute(
            "Profile_Unlock",
            "Profile/Unlock/{userID}/{unlockID}",
            new { controller = "Unlock", action = "Index" },
            new { userID = new GuidRouteConstraint(), unlockID = new GuidRouteConstraint() }
        );

        context.MapRoute(
            "Profile_default",
            "Profile/{controller}/{action}/{id}",
            new { action = "Home", id = UrlParameter.Optional }
        );
    }

Does anyone know what is going wrong?

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about visual-studio-2010