Skip to content

Instantly share code, notes, and snippets.

@fmshk97
Created February 21, 2021 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fmshk97/d897146c451f7feddbf519beaf33dea5 to your computer and use it in GitHub Desktop.
Save fmshk97/d897146c451f7feddbf519beaf33dea5 to your computer and use it in GitHub Desktop.
ReplaceRedirector() implementation
static Func<RedirectContext<CookieAuthenticationOptions>, Task> ReplaceRedirector(
HttpStatusCode statusCode,
Func<RedirectContext<CookieAuthenticationOptions>, Task> existingRedirector) => context =>
{
if (context.Request.Path.StartsWithSegments("/accounts"))
{
context.Response.StatusCode = (int) statusCode;
return Task.CompletedTask;
}
return existingRedirector(context);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment