Reputation: 11418
In an ASP MVC4 website, how do I route requests for all files in a sub folder to a route?
For example, is it possible to route URL requests to:
http://site/Assets/template.css
--> ~/Site1/Assets/subfolder/template.css
?http://site/Assets/a.png
--> ~/Site1/Assets/subfolder/a.png
?I would like to be able to dynamically register these on app_start as I cannot predict what the name of the subfolder will be until that time.
Upvotes: 0
Views: 229
Reputation: 2691
Would something like this help?
public static void RegisterBundles(BundleCollection bundles)
{
var folderName = ConfigurationManager.AppSettings["AssetFolderName"];
bundles.Add(new StyleBundle("~/" + folderName + "/css");
}
Upvotes: 1