【问题标题】:Send and retrieve key/value pair from MVC page to aspx page using POST Method使用 POST 方法从 MVC 页面向 aspx 页面发送和检索键/值对
【发布时间】:2015-01-04 03:43:30
【问题描述】:

我有一个带有超链接的 MVC 页面。超链接重定向到一个 aspx 页面。 当我重定向到 aspx 页面时,我想将数据(键/值对)从 MVC 页面发送到 aspx 页面。 (MVC 框架 5 和 .Net 框架 4.5)

并读取aspx页面的Page_load中的键/值对。

我不能使用查询字符串、会话或 cookie。

如何使用 HTTP-POST 实现这一点?

【问题讨论】:

  • 超链接是 GET,而不是 POST

标签: asp.net asp.net-mvc asp.net-mvc-4 http-post


【解决方案1】:
$('a#yourLinkId').on('click', function(){
       $.post("Controller/Method", { par1: "test", par2: "test2" } );
});

还有换页

$('a#yourLinkId').on('click', function(){
    $.post("Controller/Method", { par1: "test", par2: "test2" }, window.location.href = "Controller/Method");
});

【讨论】:

    猜你喜欢
    • 2018-04-01
    • 2012-08-28
    • 1970-01-01
    • 1970-01-01
    • 2012-07-04
    • 2011-09-10
    • 1970-01-01
    • 1970-01-01
    • 2019-12-24
    相关资源
    最近更新 更多