我有一個ApiController,很簡單,就像這樣:如何在ASP.NET Web API中指定控制器的名稱?
public class AssetController : ApiController
{
// removed for brevity
}
當我從視圖中插入一個途徑是,建立的網址是一樣的東西:
http://host/Asset
,但我想自定義名字,這樣就變成這樣:
http://host/assets
如何爲我的控制器指定自定義名稱,而不訴諸一個完整的自定義路由TA竹葉提取?
爲了使它小寫...你檢查了這個答案http://stackoverflow.com/questions/878578/how-can-i-have-lowercase-routes-in-asp-net-mvc和http: //stackoverflow.com/questions/6168270/making-url-lowercase-any-easy-or-builtin-way? 他們傾向於在這裏指向CodePlex項目http://lowercaseroutesmvc.codeplex.com/檢出部分:(第4步(如果使用ASP.NET Web API) - 重新映射您的HTTP) –
謝謝,我一直在看着這個,我一直在瀏覽源代碼,但我找不到任何幫助我的東西。我認爲今天唯一的出路是定製航線表。 –
我已更新問題主體以使其更清楚。 –