我有一个 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 出错