0
我可以有URL在更多格式:与多个可变参数的URL映射
site.net/Controller/Function/AnyStringProperty
site.net/Controller/Function/AnyIntProperty
site.net/Controller/Function/AnyStringProperty/AnyIntProperty
在控制器I可以写为Property1和Property2任何逻辑,但它似乎是肮脏的方式。
另一种方式是写类似 site.net/Controller/Function/AnyDefautlForStringProperty/AnyIntProperty
除了
site.net/Controller/Function/AnyIntProperty
是任何可能性怎么办这在routes.MapRoute函数中?或者在其他地方,然后在控制器?
routes.MapRoute(
"Controller/Function",
"Controller/Function/{AnyStringProperty}/{AnyIntProperty},
new { controller = "Controller", action = "Function", AnyStringProperty = "", AnyIntProperty = ""}
);
谢谢,我会尝试一下,但我怕它后URL不会太酷... :-) –