Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
34 Points
40 Posts
Apr 27, 2012 10:39 AM|LINK
So my APIAreaRegistration needs to changed?
using System.Web.Mvc; namespace WebSite.Areas.API { public class APIAreaRegistration : AreaRegistration { public override string AreaName { get { return "API"; } } public override void RegisterArea(AreaRegistrationContext context) { context.MapHttpRoute( "API_default", "API/{controller}/{action}/{id}", new { action = "Index", id = UrlParameter.Optional } ); } } }
to something like this?
public static void RegisterRoutes(RouteCollection routes) { var Route1 = routes.MapHttpRoute ( name: "ClientApi", routeTemplate: "client/{controller}/{param1}" ); Route1.DataTokens["Namespaces"] = new string[] {"Client"}; var Route2 = routes.MapHttpRoute ( name: "OrderApi", routeTemplate: "order/{controller}/{param1}" ); Route2.DataTokens["Namespaces"] = new string[] { "Order" }; }
If yes, how do I do that for areas or should I change the Global.asax?
Mech0z
Member
34 Points
40 Posts
Re: Cant get my routing to work
Apr 27, 2012 10:39 AM|LINK
So my APIAreaRegistration needs to changed?
using System.Web.Mvc; namespace WebSite.Areas.API { public class APIAreaRegistration : AreaRegistration { public override string AreaName { get { return "API"; } } public override void RegisterArea(AreaRegistrationContext context) { context.MapHttpRoute( "API_default", "API/{controller}/{action}/{id}", new { action = "Index", id = UrlParameter.Optional } ); } } }to something like this?
public static void RegisterRoutes(RouteCollection routes) { var Route1 = routes.MapHttpRoute ( name: "ClientApi", routeTemplate: "client/{controller}/{param1}" ); Route1.DataTokens["Namespaces"] = new string[] {"Client"}; var Route2 = routes.MapHttpRoute ( name: "OrderApi", routeTemplate: "order/{controller}/{param1}" ); Route2.DataTokens["Namespaces"] = new string[] { "Order" }; }If yes, how do I do that for areas or should I change the Global.asax?