我是新的与asp.net mvc和路由问题。 我试图修改以下网址 - 通过使用路由作为路由配置不工作
routes.MapRoute(
name: "history",
url: "{controller}/{action}",
defaults: new { controller = "Teum", action = "ClosedEvents", id = UrlParameter.Optional }
);
我在这里看到一个解决方案与Web.config中
localhost:2124/Teum/ClosedEvents
到
localhost:2124/Teum/history
,并添加到它
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="UrlRoutingModule"/>
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
<handlers>
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</handlers>
</system.webServer>
,但它仍然无法正常工作,无论哪种方式我得到404错误。
将不胜感激任何形式的帮助。
actionResult是ClosedEvents,但我希望它显示在URL作为历史 –