[英]WEB API URL Routing
我想要這樣的路徑:
localhost:99/client/themes/plain/index.html?shop=mycoolshop
顯示為:
localhost:99/client/mycoolshop/index.html.
我寫:
routes.MapPageRoute(
routeName: "Client",
routeUrl: "client/{shopname}/{page}",
physicalFile: "~/client/themes/plain/{page}?Shop={shopname}"
);
但是,沒有運氣。 當我鍵入localhost:99/client/mycoolshop/index.html
它說找不到頁面。 我究竟做錯了什么?
我認為您可能正在尋找URL重寫而不是WebAPI路由。 看看這個SO線程
您可以在web.config的system.web部分中使用此設置:
<httpRuntime relaxedUrlToFileSystemMapping="true" />
這是有關其工作原理的詳細說明。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.