Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
真的很难获得这些路由数据值......当我输入时,我似乎只能在调试器中进入它!我怎样才能找到他们?
我可能会遗漏一些东西,但这会返回什么?
RouteData.Route.Defaults["key"]; //Obviously replace "key" with the value you want
在您的情况下,RouteData.Route它作为一个RouteBase对象显示给您,因此您无法访问默认值。您需要将其转换Route为实际实现:
RouteData.Route
RouteBase
Route
((System.Web.Routing.Route)RouteData.Route).Defaults