gpt4 book ai didi

asp.net-mvc-3 - Sitecore 6.6 和 MVC 领域

转载 作者:行者123 更新时间:2023-12-04 05:24:32 25 4
gpt4 key购买 nike

我正在处理一个大型的 Sitecore 6.6 MVC 站点。老实说,我在 Google 上找不到任何好的信息。

我的问题是。我在 Controller 渲染的 Sitecore 内容编辑器中。
我希望这个 Controller 渲染指向我的 MVC 项目中的一个 MVC 区域。

在 Sitecore 中我的 Controller 渲染的数据部分中,我有 2 个文本框:
Controller

Controller Action

我在 Controller 文本框中输入什么来指向我的区域。

我的区域是这样的:<site root>/Areas/UserManagement/ProfileController.cs
我已经尝试了一切。我希望有人可以提供帮助。

最佳答案

在 Controller 字段中,您可以输入 Profile指定您的 ProfileController并在 Controller Action 字段中输入要调用的 ProfileController 的 Action 的名称。

您的 UserManagement 区域大概会有 UserManagementAreaRegistration定义区域特定路由的类,它将从 ApplicationStart 事件处理程序中调用。

这就是连接 Controller 渲染的方法。当看到这个时,有一些绊脚石:

  • Action 名称唯一性。我还没有设法获得 MapRoute 的命名空间重载,以允许出现在解决方案中其他地方的操作名称。
    public System.Web.Routing.Route MapRoute(string name, string url, object defaults, string[] namespaces)
  • 然而为了能够让 View 解析过程尊重区域路径,它似乎搜索由 Controller 名称确定的标准 View 文件夹。从您的示例中,我不得不将 Razor View 的副本放入 ~/Views/UserManagement/让它渲染。
  • 关于asp.net-mvc-3 - Sitecore 6.6 和 MVC 领域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13355013/

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