I have a login controller with a post action which redirects to home page after successful login. I am using following code for redirection, which works well in Chrome and Firefox. but doesn't redirect in IE and EDGE, and response cookie not set
private ActionResult RedirectToLocal(string returnUrl)
{
    if (Url.IsLocalUrl(returnUrl))
    {
        return Redirect(returnUrl);
    }
    else
    {
        return RedirectToRoute("default", new { controller = "", action = "" });
    }
}
My Login action
public IActionResult Login(string userName, string password)
{
   try
   {
       if (string.IsNullOrEmpty(userName) || string.IsNullOrEmpty(password))
                throw new InvalidOperationException("Username/Password can not be empty");
            var session = CreateSession(userName, password);
            var returnUrl = Request.Query["returnUrl"];
            return RedirectToLocal(returnUrl);
    }
    catch (Exception ex)
    {
        ModelState.AddModelError("Login", ex.Message);
    }
        return View();
    }
I am using my own session management for which I set session cookies like following
CookieOptions option = new CookieOptions();
option.Path = AppPath;
option.Domain = AppHost;             
httpContextAccessor.HttpContext.Response.Cookies.Append(AppSessionToken, "SomeSessionId", option);
                After searching a lot for exact answer, I found that Internet Explorer (all versions) doesn't allow you to specify a domain of localhost, a local IP address or machine name. When you do, Internet Explorer simply ignores the cookie. So I removed following line
option.Domain = AppHost;
from my codes and everything start working as expected on both IE and EDGE.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With