日期:2014-05-20  浏览次数:20824 次

ASP.NET MVC 控制器名称可以改吗?
如,有一个控制器名称为FixMoney。但不想给用户知道名称为FixMoney,我记得有看视频的时候可以改的,现在找不着了……

------解决方案--------------------
路径重写?
------解决方案--------------------
protected void Application_Start(object sender, EventArgs e)
 2 {
 3 // Note: Change Url= to Url="[controller].mvc/[action]/[id]" to enable 
 4 // automatic support on IIS6 
 5 
 6 RouteTable.Routes.Add(new Route
 7 {
 8 Url = "[controller]/[action]/[id]",
 9 Defaults = new { action = "Index", id = (string)null } ,
10 RouteHandler = typeof(MvcRouteHandler)
11 });
12 
13 
14 RouteTable.Routes.Add(new Route
15 {
16 Url = "Default.aspx",
17 Defaults = new { controller = "Home", action = "Index", id = (string)null },
18 RouteHandler = typeof(MvcRouteHandler)
19 });
20 
21 
22 }

是这个东西?