I have a web app that redirects to another one.
The 2 apps are on separate subdomain like:
*redir.second.main.com*
*landing.second.main.com*
The first app needs to write a cookie for the second one.
var cookie = new HttpCookie("cookie_name", cookie_value);
cookie.Domain = ".second.main.com";
cookie.Expires = DateTime.UtcNow.AddMinutes(2);
cookie.HttpOnly = false;
cookie.Secure = true;
Response.SetCookie(cookie);
var redirectUrl = "https://landing.second.main.com/page";
return Redirect(redirectUrl);
I think the problem is Domain, I tried
.second.main.com
.main.com
landing.second.main.com
but the cookie does not get written, like it was another domain. What am I missing here?
UPDATE 1:
Followed this one Share cookie between subdomain and domain but it doesn't seem to work for me
UPDATE 2
From comments I've been suggested to check the way I read the cookie, but beyond the way I do that, I cannot see the cookie in the browser, so I know the cookie is not getting written, and not that I cannot read it.