This is my RouteConfig file:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute("Robots.txt",
"robots.txt",
new { controller = "Home", action = "Robots" });
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
When going to www.mysite.com/Robots.txt
I get 404.
In my HomeController I have a Robots() action.
What could I be doing wrong?
Edit: going to www.mysite.com/Robots
gives me a server error 404. Going to www.mysite.com/Robots.txt
gives me an IIS 404 error. Could that have something to do with it?
Going to www.mysite.com/Home/Robots
works, but www.mysite.com/Home/Robots.txt
gives IIS 404.