Darbio
Darbio

Reputation: 11418

ASP Routing to a folder

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:

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

Answers (1)

Nilesh
Nilesh

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

Related Questions