dotnet / dotnet/aspnetcore

SignInAsync sets Location header

Open
#17,475 14 comments 0 reactions 0 assignees View on GitHub
affected-few area-auth enhancement severity-minor
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

When calling SignInAsync on the login page, the Location header gets set to the value of the returnUrl query string parameter.

https://github.com/aspnet/AspNetCore/blob/master/src/Security/Authentication/Cookies/src/CookieAuthenticationHandler.cs#L334-L335

Besides I am unclear why this would be ever useful, this is a non-obvious side effect of calling SignIn and interferes with other logic on the login page. You might not always want to do a redirect - but maybe show a view. Calling `return View(...);` will not work because the response has already been modified to be a redirect.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.