【发布时间】:2014-10-08 09:31:09
【问题描述】:
在 Composite C1 应用程序中,我试图将值从 URL 传递给 MVC Player 函数,但我遇到了麻烦,因为这些值是路径的一部分,而不是查询字符串中的一部分。
网址如下所示:
/AuctionDetailsGallery/3624734/Test-Versteigerung-2
AuctionDetailsGallery 是一个包含 MvcPlayer 功能的复合 C1 页面。 3624734 是(动态)ID,“Test-Versteigerung-2”是一个用户友好的名称
然后应该调用 MvcPlayer
/AuctionViewer/FilterGalleryPositions
(“AuctionViewer”是控制器,“FilterGalleryPositions”是动作。)
ID 必须传递给操作,但使用不同的名称(“SelectedAuctions”)。
所以本质上,如果用户调用
/AuctionDetailsGallery/3624734/Test-Versteigerung-2
我想渲染 MVC 动作
/AuctionViewer/FilterGalleryPositions?SelectedAuctions=3624734
我该怎么做?
我将 MvcPlayer 路径设置为 "/AuctionViewer/FilterGalleryPositions" 并玩弄了路由,但我总是收到消息
找不到路径“/3624734/Test-Versteigerung-2”的控制器 或者不实现 IController。
这是因为 Render 函数会检查 PathInfo 并将我设置的 Path 替换为 PathInfo(如果可用)。我想如果附加 PathInfo 会更有用,但我不确定如何使用当前的 MVC Player 实现路由我的值。
【问题讨论】:
-
@GeorgeStocker Erm,我不确定你为什么要进行编辑。我很确定这不是错误,这是 C1 MvcPlayer 的工作方式。我只是不知道如何让我的场景使用该功能。
-
对此感到抱歉,我想在您的 other 帖子中介绍 Composite C1。虽然拥有源代码在这里也有帮助。
标签: asp.net-mvc asp.net-mvc-4 asp.net-mvc-routing c1-cms