Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

RedirectResult should support preservation of HTTP method #5609

Closed

Description

@smarts

Status codes 303, 307, & 308 are valid redirect codes and should be incorporated into RedirectResult and the corresponding controller methods. My guess is that 303 probably isn't a big deal, but the other 2 should definitely be handled.
Similar issue: aspnet/HttpAbstractions#735

Activity

  1. juunas11 commented on Dec 8, 2016

    @juunas11
    Contributor

    If we are changing RedirectResult, we should be changing RedirectToActionResult and RedirectToRouteResult as well.

    Currently there is a boolean property Permanent, that specifies if a 301 or 302 is used. This would have to change so that we could specify the type e.g. with an enum. Something like:

    public enum RedirectType
    {
        Permanent = 301,
        Found = 302,
        SeeOther = 303,
        TemporaryMethodPreserved = 307,
        PermanentMethodPreserved = 308
    }
    

    The 307 and 308 status codes would need to be named in such a way that they will not be confused with 301 and 302.

    ControllerBase redirect methods would need updates too.

  2. smarts commented on Dec 8, 2016

    @smarts
    Author

    @juunas11 you could do that, or you could add another Boolean value: PreserveMethod. But yes, all the redirect-focused action results need to change. 👍
    If you do go the enum route, I would suggest adding Temporary = 302 as well, just so it's easier to correlate between *MethodPreserved and method-not-preserved.

  3. added this to the 2.0.0-preview1 milestone on Mar 6, 2017
  4. Eilon commented on Mar 6, 2017

    @Eilon
    Contributor

    For the methods on ControllerBase, each of the Redirect/RedirectToAction/RedirectToRoute methods should gain an additional overload, adding a new bool preserveMethod parameter (and all the current overloads can just call into that).

    For the RedirectResult/RedirectToActionResult/RedirectToRouteResult types, each should gain a new ctor and matching get/set property called PreserveMethod.

  5. added a commit that references this issue on Apr 11, 2017
  6. jbagga commented on Apr 11, 2017

    @jbagga
    Contributor

    Also added PreserveMethod to LocalRedirectResult

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions