I have a very basic authentication setup:
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
.AddCookie();
}
}
Now when the MVC ChallengeResult is returned (with a AuthenticationProperties argument):
public class HomeController : Controller
{
public IActionResult Index()
{
if (!User.Identity.IsAuthenticated)
{
return Challenge(new AuthenticationProperties
{
IsPersistent = true
});
}
else
{
return View();
}
}
}
The request is redirected to /Account/Login and to the following action method:
Issue: the original assignment of IsPersistent = true in the Index() action method is missing when the execution reach the Login() action method.
The App is built in: .NET Core 3.1

The argument
propertiesin actionloginis a new instance. It will be always null. Because you do not assign a value on a request. After returning toChallenge, the authentication will initiate a redirect. But the redirect will not carry this parameter.You can set an event to save the value of the cookie authentication context in the session.
In action
login.Then, the properties will be passed into login.