Wie füge ich eine Route zur dynamischen robots.txt in ASP.NET MVC hinzu?

Ich habe eine robots.txt, die nicht statisch ist, sondern dynamisch generiert wird. Mein Problem ist das Erstellen einer Route von root / robots.txt zu meiner Controller-Aktion.

Diesefunktioniert:

routes.MapRoute(
name: "Robots",
url: "robots",
defaults: new { controller = "Home", action = "Robots" });

Diesefunktioniert nicht:

routes.MapRoute(
name: "Robots",
 url: "robots.txt", /* this is the only thing I've changed */
defaults: new { controller = "Home", action = "Robots" });

Die ".txt" bewirkt, dass ASP anscheinend blockiert

Antworten auf die Frage(2)

Ihre Antwort auf die Frage