Asp.NET MVC:使用POST操作重定向到另一个控制器 [英] Asp.NET MVC : redirect to another controller with POST Action

查看:213
本文介绍了Asp.NET MVC:使用POST操作重定向到另一个控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是我想使用POST数据而不是GET重定向到另一个控制器中的操作

My issue is that i want to make redirection to action in another Controller with POST DATA not a GET

RedirectToAction("GenaraleExportPDF", "ExportController", new { 

screendata = json, monTitre = monTitre, file = file, block1 = block1, block2 = block2, block3 = block3, block4 = block4 

});

此示例检查重定向,但使用GET Action。

推荐答案

您可以看到此处 RedirectToAction 向浏览器返回HTTP 302响应,这将导致浏览器向指定操作发出GET请求。

As you can see here, RedirectToAction returns an HTTP 302 response to the browser, which causes the browser to make a GET request to the specified action.

重定向 RedirectPermanent 也无法解决您的问题。它们之间的基本区别是 RedirectPermanent 向浏览器发送HTTP 301(永久移动)状态代码,而 Redirect 将发送浏览器HTTP 302状态代码。

Redirect and RedirectPermanent will not solve your problem also. The basic difference between them is that RedirectPermanent sends the browser an HTTP 301 (Moved Permanently) status code whereas Redirect will send an HTTP 302 status code.

您无法使用POST创建重定向。

You are unable to create redirect with POST.

您可以使用 Session 在页面之间存储和发送数据。

You can use Session for storing and sending data between pages.

这篇关于Asp.NET MVC:使用POST操作重定向到另一个控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆