3
A
回答
1
這樣的事情?
routes.MapRoute("User",
"{UserName}",
new { Controller = "User", Action = "Index", UserName = "" });
更新:
此約束添加到 「用戶」 路線:
routes.MapRoute("User",
"{UserName}",
new { Controller = "User", Action = "Index", UserName = "" },
new { UserName = @"(\w|-)+" }
);
或添加這條路線:
routes.MapRoute("Home",
String.Empty,
new { Controller = "Home", Action = "Index", Id = "" }
);
相關問題
- 1. Ruby on Rails路線全部收錄
- 2. .htaccess url路由子目錄
- 3. Kohana的路由外部URL
- 4. nodeJS路由全部請求
- 5. Rails路由:收集路由不斷添加「_index」到url助手?
- 6. 全部接收路由器進出口不起作用
- 7. URL類別/方法路由的安全
- 8. 路由器的URL與nginx的目錄
- 9. Url在asp.net中路由目錄mvc3
- 10. Node.js:帶有CNAME記錄的url路由
- 11. Angular2路由通過每個url登錄
- 12. URL路由和目錄重定向
- 13. 瓶URL路由
- 14. URL路由
- 15. URL路由
- 16. Codeigniter URL路由?
- 17. Knockout.js URL路由
- 18. URL路由3
- 19. MVC4 Url路由
- 20. MVC3 URL路由
- 21. Codeigniter URL路由
- 22. MVC Url路由
- 23. JSF URL路由
- 24. Backbone.js URL路由
- 25. Codeigniter路由URL
- 26. Laravel路由URL?
- 27. 收藏全部全部Android
- 28. Url路由問題多個部門
- 29. Playframework:將條目路由到外部URL
- 30. laravel 5重定向路由外部URL
你能澄清你的意思是什麼'無法讓用戶通過'?你是在談論路線的「用戶」部分還是你期望的其他一些數據?這可能是一個路由問題,建立一個默認路由,或一個處理特定場景,並不是太困難。 – nkirkes 2009-07-21 18:04:40
如果網址是http://www.mycompany.com/user 我期望被路由到這個ActionResult public ActionResult Index(string userName) { //這個userName參數在它應該是//字符串用戶 UserModel model = Data.GetUser(userName); return查看(model); } – Sammy 2009-07-21 18:30:53