You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
RedirectResult should support preservation of HTTP method #5609
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
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.
@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.
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.
Activity
juunas11 commentedon Dec 8, 2016
If we are changing RedirectResult, we should be changing
RedirectToActionResultandRedirectToRouteResultas 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: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.
ControllerBaseredirect methods would need updates too.smarts commentedon Dec 8, 2016
@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 = 302as well, just so it's easier to correlate between *MethodPreserved and method-not-preserved.Eilon commentedon Mar 6, 2017
For the methods on ControllerBase, each of the Redirect/RedirectToAction/RedirectToRoute methods should gain an additional overload, adding a new
bool preserveMethodparameter (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.
Add PreserveMethod (#6075)
jbagga commentedon Apr 11, 2017
Also added
PreserveMethodtoLocalRedirectResult