I have the following couple of methods in my CommentsController.
[HttpGet]
[Authorize]
public ActionResult New(long id)
{
return RedirectToAction("Details", "Posts", new { id }); // lets be graceful.
}
[HttpPost]
[Authorize]
public ActionResult New(long id, string comment, IMiniPrincipal principal)
{
throw new NotImplementedException();
}
Both are resolved through any posts/{id}/comment route where id is a numeric value. I added the GET action mostly to avoid confusion (instead of just telling the user it doesn’t exist when they attempt to access the route manually instead of through a form POST, I redirect them to the post the comment would’ve been submitted to).
The question is whether I can use a Permanent Redirect result in HTTP GET requests and still not get permanently redirected during HTTP POST requests?
Permanent redirect works on a per-method basis, so you can actually perform a permanent redirect on a
POSTto a given url, while serving content onGETrequests to the same url.