Hi,
i have an Area called Members and the following registered routes in the MembersAreaRegistration file:
context.MapRoute(
"Members_Profile",
"Members/Profile/{id}",
new { controller = "Profile", action = "Index", id = UrlParameter.Optional },
new string[] { "MyProject.Web.Mvc.Areas.Members.Controllers" }
);
context.MapRoute(
"Members_default",
"Members/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = UrlParameter.Optional },
new string[] { "MyProject.Web.Mvc.Areas.Members.Controllers" }
);
I want to be able to map the following URLs:
~/Members (should map ~/Members/Home/Index )
~/Members/Profile/3 (should map ~/Members/Profile/Index/3)
With this route registrations everything works fine. However, I added the following URL:
~/Members/Profile/Add
and I got the error:
"The parameters dictionary contains a null entry for parameter 'id' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Index(Int32)' in 'MyProject.Web.Mvc.Areas.Members.Controllers.ProfileController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter."
I also want to have the URL
~/Members/Profile/Edit/3
What should I modify in order to have all this URLs working properly?