I have basically an out-of-the box MVC 5.2 app, with attribute-based routes enabled (calling routes.MapMvcAttributeRoutes();
from the provided RouteConfig.RegisterRoutes(RouteCollection routes)
method).
The following is in HomeController:
[Route("hello.txt")]
[Route("hellotxt-testing")]
public ActionResult ShowFile()
{
return Content("Hello world");
}
I can successfully access /hellotxt-testing
(proving attribute-based routing is working correctly):
But I get a 404 page if I access /hello.txt
:
In contrast to when I go to /hello404
, where I get a different 404 page:
I am guessing that the second 404 page is from ASP.NET, while the first is from IIS which isn't even passing the request to ASP.NET?
What do I do to ensure that I can ensure ASP.NET gets these URLs that have periods in them? Are there other 'special' characters that would also cause a problem?