我有以下路线
routes.MapRoute(
name:="Gallery",
url:="{controller}/{action}/{*id}",
defaults:=New With {
.controller = "Gallery",
.action = "Index",
.id = UrlParameter.Optional},
constraints:=New With {.id = ".*"}
)
我正在尝试匹配以下网址:
- /画廊/拇指/SomeDirectory
- /画廊/拇指/SomeDirectory/
- /Gallery/Thumb/SomeDirectory/SomeImage.jpg
在每种情况下,我都希望使用适当的路径调用的Thumb
动作。GalleryController
现在,
/Gallery/Thumb/SomeDirectory = 404.0 (Seems it doesn't match a route, passes straight through to IIS 404)
/Gallery/Thumb/SomeDirectory/ = Works
/Gallery/Thumb/SomeDirectory/SomeImage.jpg = 404.0 (Same as above)
/Gallery/Thumb/SomeDirectory/SomeImage = Works (routing works, although the path supplied in Id isn't a useful one)
我需要对我的路线做些什么才能在 id 中通过操作后传递所有内容?