-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
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
Culture is lost when redirect to login #1
Labels
bug
Something isn't working
Comments
add login redirection rules in startup: services.ConfigureApplicationCookie(options =>
{
options.Events = new CookieAuthenticationEvents
{
OnRedirectToLogin = ctx =>
{
var requestPath = ctx.Request.Path;
var culture = ctx.Request.RouteValues["culture"];
ctx.Response.Redirect($"/{culture}/Identity/Account/Login/?ReturnUrl={requestPath}{ctx.Request.QueryString}");
return Task.CompletedTask;
}
};
}); |
LazZiya
added a commit
that referenced
this issue
Sep 26, 2019
fixed in commit c9b2a7f |
improved approach provided in commit c1f7e3d services.ConfigureApplicationCookie(options =>
{
options.Events = new CookieAuthenticationEvents
{
OnRedirectToLogin = ctx =>
{
var culture = ctx.Request.RouteValues["culture"];
var requestPath = ctx.Request.Path;
if (culture == null)
{
culture = "en";
requestPath = $"/{culture}{requestPath}";
}
ctx.Response.Redirect($"/{culture}/Identity/Account/Login/?ReturnUrl={requestPath}{ctx.Request.QueryString}");
return Task.CompletedTask;
}
};
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If unlogged user clicked on a page that requires authorization, the user is redirected to login page but with the culture parameter is lost!
e.g. : unlogged user clicks on below link:
http://localhost:1234/tr/Identity/Account/ChangePassword/
he will be redirected to :
http://localhost:1234/Identity/Account/Login/
The text was updated successfully, but these errors were encountered: