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.