title: ReturnUrl not working and is always null
body: <p>In my ASP.NET MVC Core web app with <code>Individual User Account</code> authentication, the <code>returnurl</code> in the default login() get and post action methods (shown below) is always null. I verified it by placing a breakpoint after the line <code>ViewData["ReturnUrl"] = returnUrl;</code>. When I login to the app I see at the breakpoint that returnUrl is always null. Why is that even though I can see that the corresponding form tag has <code>asp-route-returnurl="@ViewData["ReturnUrl"]"</code> attribute value defined? I see the same null behavior in other action methods where I'm using returnUrl and making sure that the corresponding form tags of these action methods have <code>asp-route-returnurl="@ViewData["ReturnUrl"]"</code> attribute defined.</p>
  
  <p><strong>AccountCountroller</strong>:</p>
  
  <pre><code>[Authorize]
  public class AccountController : Controller
  {
  
      //
      // GET: /Account/Login
      [HttpGet]
      [AllowAnonymous]
      public IActionResult Login(string returnUrl = null)
      {
          ViewData["ReturnUrl"] = returnUrl;
          return View();
      }
  
      //
      // POST: /Account/Login
      [HttpPost]
      [AllowAnonymous]
      [ValidateAntiForgeryToken]
      public async Task&lt;IActionResult&gt; Login(LoginViewModel model, string returnUrl = null)
      {
          ViewData["ReturnUrl"] = returnUrl;
          if (ModelState.IsValid)
          {
              // This doesn't count login failures towards account lockout
              // To enable password failures to trigger account lockout, set lockoutOnFailure: true
              var result = await _signInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, lockoutOnFailure: false);
              if (result.Succeeded)
              {
                  _logger.LogInformation(1, "User logged in.");
                  return RedirectToLocal(returnUrl);
              }
              if (result.RequiresTwoFactor)
              {
                  return RedirectToAction(nameof(SendCode), new { ReturnUrl = returnUrl, RememberMe = model.RememberMe });
              }
              if (result.IsLockedOut)
              {
                  _logger.LogWarning(2, "User account locked out.");
                  return View("Lockout");
              }
              else
              {
                  ModelState.AddModelError(string.Empty, "Invalid login attempt.");
                  return View(model);
              }
          }
  
          // If we got this far, something failed, redisplay form
          return View(model);
      }
  
  }
  </code></pre>
  
  <p><strong>Snapshot of login.cshtml view</strong>:</p>
  
  <pre><code>&lt;form asp-controller="Account" asp-action="Login" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal"&gt;
  .....//rest of the html removed for brevity
  .....
  &lt;/form&gt;
  </code></pre>