Prerendering server-side code can now issue redirections. Fixes #280
This commit is contained in:
parent
c2c45b04df
commit
1be9102aea
|
|
@ -85,6 +85,15 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
|
|||
unencodedPathAndQuery,
|
||||
CustomDataParameter,
|
||||
TimeoutMillisecondsParameter);
|
||||
|
||||
if (!string.IsNullOrEmpty(result.RedirectUrl))
|
||||
{
|
||||
// It's a redirection
|
||||
ViewContext.HttpContext.Response.Redirect(result.RedirectUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
// It's some HTML to inject
|
||||
output.Content.SetHtmlContent(result.Html);
|
||||
|
||||
// Also attach any specified globals to the 'window' object. This is useful for transferring
|
||||
|
|
|
|||
|
|
@ -6,5 +6,6 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
|
|||
{
|
||||
public JObject Globals { get; set; }
|
||||
public string Html { get; set; }
|
||||
public string RedirectUrl { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue