HI All,
I have a number of controllers they are in different namespaces. In the Application I have generic menu bar and so depending upon the namespace that you are in, I need the buttons on the menu to route to different pages.
when I run the application and am in the following namespaces (namespsaces are based on the type of user logged in).
this code all works fine, so when I am in either namespace the routing works correctly.
Code:
context.MapRoute(
"CreateAppraisal", // Route name
"Suppliers/{controller}/{action}/{appraiseeId}", // URL with parameters
new { controller = "Appraisals", action = "Create", appraiseeId = UrlParameter.Optional }, new string[] { "revalidations.Web.Areas.Suppliers.Controllers", "revalidations.Web.Controllers" }
);
context.MapRoute(
"Search", // Route name
"Suppliers/{controller}/{action}/{name}", // URL with parameters
new { controller = "Appraisals", action = "AppraiserSearch", name = UrlParameter.Optional }, new string[] { "revalidations.Web.Areas.Suppliers.Controllers", "revalidations.Web.Controllers" }
);
Now in the second set of routemappings I have:
Code:
context.MapRoute(
"Clinicians_default",
"Clinicians/{controller}/{action}/{id}",
new { controller = "Home", action = "Home", id = UrlParameter.Optional }, new string[] { "revalidations.Web.Areas.Clinicians.Controllers", "revalidations.Web.Controllers" }
);
context.MapRoute(
"Clinicians_ListAppraisal", // Route name
"Clinicians/{controller}/{action}", // URL with parameters
new { controller = "Appraising", action = "Index" }, new string[] { "revalidations.Web.Areas.Clinicians.Controllers", "revalidations.Web.Controllers" }
);
and they do not work when I am in the second namespace. Now the controller names are unique across all areas.
When I login as the user type that gives me the working set of mappings in both namespaces when I hover over my buttons I'll see the address of : Suppliers/appraisals...... and thus mapped ok.
When I login as a user that uses the second set before I navigate anywhere the mappings are set correctly i.e. I see Clinicians/Appraising....
however, once I move onto a page that is in the second namespace whe I hover over the buttons it looses the Clinicians/ and starts with Appraising and then of course crashes because it cant find the controller.