We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
Wystarczy podpiąć mapowanie z wywołać przekierowanie:
app.UseEndpoints(endpoints => { endpoints.MapGet("/", async context => context.Response.Redirect("hangfire")); }
Dla większej czytelności i wygody można utworzyć własną metodę rozszerzającą:
public static class EndpointExtensions { public static IEndpointRouteBuilder Redirect( this IEndpointRouteBuilder endpoints, string from, string to) { return Redirect(endpoints, new Redirective(from, to)); } public static IEndpointRouteBuilder RedirectPermanent( this IEndpointRouteBuilder endpoints, string from, string to) { return Redirect(endpoints, new Redirective(from, to, true)); } public static IEndpointRouteBuilder Redirect( this IEndpointRouteBuilder endpoints, params Redirective[] paths ) { foreach (var (from, to, permanent) in paths) { endpoints.MapGet(from, async http => { http.Response.Redirect(to, permanent); }); } return endpoints; } } public record Redirective(string From, string To, bool Permanent = false);
na podst. https://khalidabuhakmeh.com/simple-redirects-with-aspnet-core-endpoint-routing
Sorry, something went wrong.
sulmar
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: