ASP.Net MVC路线映射

我是MVC(和ASP.Net路由)的新手.我正在尝试将* .aspx映射到名为PageController的控制器.
routes.MapRoute(
   "Page","{name}.aspx",new { controller = "Page",action = "Index",id = "" }
);

上面的代码不会映射* .aspx到PageController?当我运行它并键入任何.aspx页面,我得到以下错误

The controller for path ‘/Page.aspx’ Could not be found or it does not implement the IController interface.
Parameter name: controllerType

有没有什么我不在这里

解决方法

I just answered my own question. I had
the routes backwards (Default was
above page).

是的,您必须将所有自定义路由放在认路由之上.

So this brings up the next question…
how does the “Default” route match (I
assume they use regular expressions
here) the “Page” route?

认路由根据我们称之为“公约配置”的规则进行匹配. Scott Guthrie在他的第一篇关于ASP.NET MVC的博文中解释得很好.我建议你阅读它和他的其他职位.请记住,这些是基于第一个CTP发布的,框架已经改变了.您也可以在Scott Hanselman的asp.net网站上找到ASP.NET MVC上的web cast.

> http://weblogs.asp.net/scottgu/archive/2007/11/13/asp-net-mvc-framework-part-1.aspx
> http://www.asp.net/MVC/

相关文章

### 创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(...
一、SiganlR 使用的协议类型 1.websocket即时通讯协议 2.Ser...
.Net 6 WebApi 项目 在Linux系统上 打包成Docker镜像,发布为...
一、 PD简介PowerDesigner 是一个集所有现代建模技术于一身的...
一、存储过程 存储过程就像数据库中运行的方法(函数) 优点:...
一、Ueditor的下载 1、百度编辑器下载地址:http://ueditor....