Subject. My code
public ActionResult Index() { if (Request.UserLanguages.Count() != 0 & Request.UserLanguages.Contains("ru-RU")) return View("Ru"); return View(); } Ru view exists in the same folder as Index
Subject. My code
public ActionResult Index() { if (Request.UserLanguages.Count() != 0 & Request.UserLanguages.Contains("ru-RU")) return View("Ru"); return View(); } Ru view exists in the same folder as Index
The path to this view will look like / {controller} / {action}, Ie in your case, localhost: port / controller / Index , and only then will the search for the "Ru.cshtml" view be made.
The route refers to the action method, not the file.
You can add your route to RouteConfig:
routes.MapRoute( name: "MyPath", url: "{controller}/RU", defaults: new { controller = "Ваш_контроллер", action = "Index", id = UrlParameter.Optional } ); Source: https://ru.stackoverflow.com/questions/560414/
All Articles