Asp.Net Mvc MapRoute .html不起作用(转)

RegisterRoutes 注册路由示例配置:

public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute(
name: "default",
url: "controller/{id}.htm",
defaults: new { controller = "Home", action = "Index" });
}

Controller 示例代码

public class HomeController : Controller
{
// GET: Home
public ActionResult Index(int id)
{
return View();
}
}

解决方式在 Web.config 中添加如下配置:

<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
上一篇:偏最小二乘回归(PLSR)- 2 标准算法(NIPALS)


下一篇:NPOI读取Excel,导入数据到Excel练习01