I added the content in white to RouteConfig.cs:
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.Http;
namespace SomethingSimple
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Foo",
url: "Foo/{id}",
defaults: new { controller = "Foo", action = "Index", id = UrlParameter.Optional }
);
routes.MapHttpRoute(
name: "Bar",
routeTemplate: "Bar/{id}",
defaults: new { controller = "Bar", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index",
id = UrlParameter.Optional }
);
}
}
}
No comments:
Post a Comment