I want to redirect to an action method of another controller such that the b开发者_如何学编程rowser issues POST instead of GET verb.
Is it possible to do that?
Well the nature of a "redirect" in HTTP terms is an instruction to the browser to perform a HTTP GET to a particular URL.
So, in HTTP terms - it's not possible.
However :)
Instead of doing RedirectToAction("ActionMethod", "Controller", new { param = value })
, you could do return View("ActionMethod", value)
which would pass the value
as a key/value pair in the HTTP POST body, assuming ActionMethod
is setup with [HttpPost]
, like so:
[HttpPost]
public ActionResult ActionMethod(string param)
{
}
However, keep in mind that will not perform a redirect - it's like of the equivalent of a cross-page postback in ASP.NET Web Forms.
精彩评论