WebFX 156 - Introducing RedirectPermanent.
Merging RedirectPermanent to Redirect.
This commit is contained in:
parent
ee37c75544
commit
9f3433acec
|
|
@ -23,7 +23,12 @@ namespace Microsoft.AspNet.Abstractions
|
||||||
|
|
||||||
public abstract void OnSendingHeaders(Action<object> callback, object state);
|
public abstract void OnSendingHeaders(Action<object> callback, object state);
|
||||||
|
|
||||||
public abstract void Redirect(string location);
|
public virtual void Redirect(string location)
|
||||||
|
{
|
||||||
|
Redirect(location, permanent: false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void Redirect(string location, bool permanent);
|
||||||
|
|
||||||
public abstract Task WriteAsync(string data);
|
public abstract Task WriteAsync(string data);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -107,9 +107,17 @@ namespace Microsoft.AspNet.PipelineCore
|
||||||
HttpResponseInformation.OnSendingHeaders(callback, state);
|
HttpResponseInformation.OnSendingHeaders(callback, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Redirect(string location)
|
public override void Redirect(string location, bool permanent)
|
||||||
{
|
{
|
||||||
HttpResponseInformation.StatusCode = 302;
|
if (permanent)
|
||||||
|
{
|
||||||
|
HttpResponseInformation.StatusCode = 301;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
HttpResponseInformation.StatusCode = 302;
|
||||||
|
}
|
||||||
|
|
||||||
Headers.Set(Constants.Headers.Location, location);
|
Headers.Set(Constants.Headers.Location, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue