【发布时间】:2013-06-14 04:30:02
【问题描述】:
我有一个 robots.txt,它不是静态的,而是动态生成的。我的问题是创建从 root/robots.txt 到我的控制器操作的路由。
这有效:
routes.MapRoute(
name: "Robots",
url: "robots",
defaults: new { controller = "Home", action = "Robots" });
这不起作用:
routes.MapRoute(
name: "Robots",
url: "robots.txt", /* this is the only thing I've changed */
defaults: new { controller = "Home", action = "Robots" });
“.txt”显然会导致 ASP 出错
【问题讨论】:
标签: asp.net-mvc asp.net-mvc-routing robots.txt