Is it possible to return a 307 Temporary Redirect
from a controller in ASP.NET MVC?
I sometimes need to re-POST
the values submitted from one form to another URI.
Using JavaScript to do the selection on the client side (thereby bypassing this issue) is not an option.
Redirecting via a GET
is not an option as posted data includes an 8k string which is likely to mean that the URI would be too long for some (many?) browsers.
Is this even possible?
Take a look at the following article - you can use the same technique for 307:
To return a 307 redirect result from an MVC action, use the following:
public ActionResult Action()
{
string url = GetRedirectUrl()
HttpContext.Response.AddHeader("Location", url);
return new HttpStatusCodeResult(307);
}
来源:https://stackoverflow.com/questions/1644045/return-307-temporary-redirect-in-asp-net-mvc