gpt4 book ai didi

asp.net-mvc-2 - .NET MVC2 - 我的区域 url 没有注册?

转载 作者:行者123 更新时间:2023-12-01 02:03:58 24 4
gpt4 key购买 nike

我有一个新的 MVC-2 项目,我在其中添加了“成员”区域。我创建了一个名为:'profile' 的 Controller 。

这有效:http://localhost:1234/Profile (加载 index() 函数)
然而,这不是:http://localhost:1234/Member/Profile (我收到 404 错误)

我是不是漏掉了什么?

最佳答案

这没有理由不起作用。从默认项目模板:

  1. 右键单击项目添加 -> 区域:成员
  2. ~/Areas/Member/Controllers 中添加包含默认 Index 操作的 ProfileController
  3. ~/Areas/Member/Views/Profile 中添加 Index.aspx
  4. 运行应用程序并导航到 /member/profile => 它显示新添加的页面

关于asp.net-mvc-2 - .NET MVC2 - 我的区域 url 没有注册?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4221451/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com