Is the Content folder special to the underlying framework of MVC? I can’t find any reference to it in routing code or configuration.
I’m just wondering if static content can be handled in different ways.
On a related note, stackoverflow’s script and css content seems to be retrieved by version number in the querystring:
<link href="/Content/all.min.css?v=2516" rel="stylesheet" type="text/css" />
Care to speculate how this might work and why this would be important?
No magic, the System.Web.Routing.RouteCollection class has a property RouteExistingFiles which controls the behavior.
The default is false, which means ASP Routing should not route the URL, but just return the default content. In this case the “/Content/all.min.css?v=251” skips the MVC routing rules entirely.
if you want to add a routing rule for the content folder, you need to add the rule, and set RouteExistingFiles to true.