File path as MVC route argument

前端 未结 2 1546
一整个雨季
一整个雨季 2020-12-10 11:42

Part of my application maps resources stored in a number of locations onto web URLs like this:

http://servername/files/path/to/my/resource/

相关标签:
2条回答
  • 2020-12-10 12:17

    For more information on ASP.NET's Routing feature, please see MSDN:

    http://msdn.microsoft.com/en-us/library/cc668201.aspx

    And for the "catch-all" parameters you want to use, see the section under "Handling a Variable Number of Segments".

    0 讨论(0)
  • 2020-12-10 12:25

    A route like

    "Files/{*path}"
    

    will get the path as a single string. The * designates it as a wildcard mapping and it will consume the whole URL after "Files/".

    0 讨论(0)
提交回复
热议问题