我有一个新的 MVC-2 项目,我在其中添加了“成员”区域。我创建了一个名为:'profile' 的 Controller 。
这有效:http://localhost:1234/Profile (加载 index() 函数)
然而,这不是:http://localhost:1234/Member/Profile (我收到 404 错误)
我是不是漏掉了什么?
最佳答案
这没有理由不起作用。从默认项目模板:
- 右键单击项目添加 -> 区域:
成员
- 在
~/Areas/Member/Controllers
中添加包含默认Index
操作的ProfileController
- 在
~/Areas/Member/Views/Profile
中添加Index.aspx
- 运行应用程序并导航到
/member/profile
=> 它显示新添加的页面
关于asp.net-mvc-2 - .NET MVC2 - 我的区域 url 没有注册?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4221451/