Reputation: 336
I have RouteConfig
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "EmployerDefault",
url: "{lang}/employer",
defaults: new { lang = "ru", controller = "Employer", action = "Index" }
);
}
}
and Controller
public class EmployerController : Controller
{
public ActionResult Index()
{
return View("EmployerMaster");
}
}
When i go to link /employer , i get HTTP 404.0 - Not Found , but when i try to get /ru/employer it's OK. I want that /employer and /ru/employer links refer to one page. Why it's happens ? How can i fix that ?
Upvotes: 0
Views: 1338
Reputation: 6366
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "EmployerDefault",
url: "/employer",
defaults: new { lang = "ru", controller = "Employer", action = "Index" }
routes.MapRoute(
name: "EmployerWithLang",
url: "{lang}/employer",
defaults: new { lang = "ru", controller = "Employer", action = "Index" }
);
}
}
Upvotes: 1