C# .NET MVC路由(忽略文件扩展名)

C# .NET MVC路由(忽略文件扩展名),c#,asp.net-mvc,azure,asp.net-mvc-routing,C#,Asp.net Mvc,Azure,Asp.net Mvc Routing,我想为Azure Blob存储设置代理页 我希望所有与/^MyArea\/Asset\/.$/匹配的请求都路由到MyArea.IndexController.AssetAction public class MyAreaAreaRegistration : AreaRegistration { public override void RegisterArea(AreaRegistrationContext context) { context.MapRout

我想为Azure Blob存储设置代理页

我希望所有与
/^MyArea\/Asset\/.$/
匹配的请求都路由到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"}
        );
    }
}
然后,我将在操作中执行以下操作

public ActionResult Asset(string resource)
{
    // fetch content from Azure Blob Storage and return it.
    return Content(/* some conent */);
}
如果请求是
/MyArea/Asset/foo
,则此操作正常,但如果请求是
/MyArea/Asset/foo.txt
,则此操作无效

如何让路由器忽略文件扩展名并将所有内容传递给单个操作

--

扩展名可以是.txt、.js、.json等。我仍然希望JsonResult重载在应用程序的其他地方工作。


  <system.webServer>
     <modules runAllManagedModulesForAllRequests="true">

看看这个,我在web.config区域做了这个,但它不起作用。我还需要做什么吗?它是否在您的顶级web.config中?