使用mvc3 razor 时,需要做伪静态,只需把Global.aspx.cs中的默认路由改一下,再添加几条,如下:

routes.MapRoute(“NoAction”, "{controller}.html", new { controller = "Company", action = "index", id = UrlParameter.Optional }, new[] { "Studio.Controllers" });//无Action的匹配
	routes.MapRoute("NoID", "{controller}/{action}.html", new { controller = "Company", action = "index", id = UrlParameter.Optional }, new[] { "Studio.Controllers" });//无ID的匹配
	routes.MapRoute("Default", "{controller}/{action}/{id}.html", new { controller = "Company", action = "index", id = UrlParameter.Optional }, new[] { "Studio.Controllers" });//默认匹配
	routes.MapRoute("Root", "", new { controller = "Company", action = "index", id = UrlParameter.Optional }, new[] { "Studio.Controllers" });//根目录匹配

然后在页面里链接就如:

http://localhost:63805/controller.html //无Action的匹配

http://localhost:63805/controller/action.html //无id的匹配

http://localhost:63805/controller/action/id.html//默认

设置之后的url就可以带html了。但是这只是url的显示形式,使路径静态化,那么如果要实现真正的静态,请看教程:Mvc静态化实现