【发布时间】:2015-10-22 09:24:51
【问题描述】:
我的 asp.net mvc 应用程序中有两条路由
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{culture}/{controller}/{action}/{id}",
defaults: new { culture = CultureHelper.GetDefaultCulture(), controller = "Home", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Default no language",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
当我在浏览器中输入 url http://localhost/gallery时,我被重定向到 http://localhost/,当我尝试 http://localhost/gallery/index 时,我收到 404 错误
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /gallery/index
当我将任何已实现的语言添加到 url (http://localhost/en/gallery) 时,应用程序正在运行。
我是路由和 webapp 编程的新手,所以如果有人可以帮助我详细解释如何解决这个问题,我会很高兴。
【问题讨论】:
标签: asp.net asp.net-mvc routes