Navigation loses Default URL

I am having an issue with security. It seems that if I use security in my .net 8 Web App in auto with PWA the default url is lost when credentials are entered incorrectly and then correctly on the second attempt. When the navigation is lost, I get the following 404 page.


Not sure how to fix it. I have tried it in my application, as well as a test application with nothing but one page and security.

I have not tested w/o PWA or Just doing Server or Just doing Webassembly. If you want me to try that first, let me know, but I really need this in my current application.

I also did share the test project

p.s. I just used the default admin log on the test, but it works that way for any user. You can add one and test.

Try changing the RedirectWithError method in AccountController with this

private IActionResult RedirectWithError(string error, string redirectUrl = null)
     if (!string.IsNullOrEmpty(redirectUrl))
         return Redirect($"~/Login?error={error}&redirectUrl={Uri.EscapeDataString(redirectUrl.Substring(1))}");
         return Redirect($"~/Login?error={error}");

Yup, that fixed it! Thank you!

I'm Still facing the Issue, Even I have replaced the code as you suggested!