在 Sitecore 中回发到当前页面

Posting back to current page in Sitecore

我正在尝试使用 Sitecore 7.2 在我的页面上创建一些 post 方法,不幸的是它们无法正常工作,我似乎无法找到处理它的最佳方法。

我有两个方法

        [HttpGet]
        public ActionResult ViewApplicationsPage(){
        //do stuff
        }

        [HttpPost]
        public ActionResult ViewApplicationsPage(ApplicationPageViewModel model, (form parameters)){
        //do other stuff
        }

该页面是 /View-Application 但是当我使用 Html.BeginForm 或 Url.Action 它指向 "api/sitecore/ViewApplications/ViewApplicationsPage"

所以如果不像 url + "?" + "&page=" pageValue + &count=" + countValue 等那样手动构建字符串,我无法将 post 数据发送到控制器

有没有一种方法可以引用正确的区域并以比手动构造字符串更好的方式传递值。

我需要在同一页面上应用过滤器和分页。

[HttpPost][HttpGet]不是倒置了吗?我的意思是,您应该期待来自 post 而不是 get.

的表单值

正如 RobertoBr 所说,您的 Http 动词倒退了。 Http GET 请求会将您的数据附加为 url 本身内部的一系列 key/value 对 - 这就是为什么您必须进行一些奇怪的字符串构建才能正确命中您的控制器。 Http POST 请求将在消息正文本身内以 key/value 对的形式发送数据。

我也会看一下方法签名 - 我认为您会传回视图模型或表单集合,但可能不会同时返回表单提交类型操作。