devlife
devlife

Reputation: 16155

I can't get areas working in VS2010

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?

Upvotes: 0

Views: 75

Answers (1)

Raj Kaimal
Raj Kaimal

Reputation: 8304

Use the routing debugger to find out which route is being applied

http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx

Upvotes: 1

Related Questions