1

I want to set up a proxy page for Azure Blob Storage.

I want all requests that match /^MyArea\/Asset\/.*$/ to route to the MyArea.IndexController.AssetAction.

public class MyAreaAreaRegistration : AreaRegistration 
{
    public override void RegisterArea(AreaRegistrationContext context) 
    {
        context.MapRoute(
            "MyArea_assets",
            "MyArea/Asset/{resource}",
            new { controller = "Index", action = "Asset"}
        );
    }
}

I will then do the following in the Action.

public ActionResult Asset(string resource)
{
    // fetch content from Azure Blob Storage and return it.
    return Content(/* some conent */);
}

This works okay if the request is /MyArea/Asset/foo but doesn't if its /MyArea/Asset/foo.txt.

How can I get the router to ignore the file extension and pass everything to a single action?

--

The extension can be anything .txt, .js, .json etc. I still want the JsonResult overloads to work elsewhere in the app.

Simon
  • 5,158
  • 8
  • 43
  • 65
  • See this http://stackoverflow.com/questions/19972092/asp-net-mvc-route-with-values-before-the-controller-and-no-trailing-slash/19978599#19978599 – LostInComputer Jan 23 '14 at 14:29

1 Answers1

2
  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true">
Nathan
  • 1,016
  • 7
  • 16