Internet Explorer 11 won't set cookies on a site
Solution 1
IE 11 does not like a domain value in the cookie. Leave it empty.
Wrong for IE 11:
Set-Cookie: kohanasession=foobar; expires=Tue, 09-Apr-2016 01:01:01 GMT; path=/; domain=tc.mk; httponly
Correct for IE 11:
Set-Cookie: kohanasession=foobar; expires=Tue, 09-Apr-2016 01:01:01 GMT; path=/; httponly
Solution 2
This may only apply to another-domain cookies, but if someone finds this via Google (like I did) this may help.
IE11 may not set cookies depending on its Privacy settings.
This worked for me:
(Internet Options -> Privacy -> Advanced -> enable all cookie cases there)
Solution 3
I know this is old, but hopefully this helps someone in the future.
You cannot have a blank expires=;
value in a cookie in IE11. You just have to leave the expires
field out altogether.
Solution 4
I had this issue because I was running a single-page Vue application. I was setting the cookie in one route, then immediately routing to a different "page". However, it seems like IE won't send cookies until next page load. So instead of using pushState, I had to force the browser to re-load the page.
Solution 5
I recently had this problem myself. In my case, the problem was caused by executing the "ClearAuthenticationCache" command upon successful login. The command was executed to remove HTTP authentication, but it turns out that it will remove session cookies as well.
So I would recommend removing the "ClearAuthenticationCache" call if you executing it after a login.
document.execCommand("ClearAuthenticationCache");
For more information, please see the following link: https://blogs.msdn.microsoft.com/ieinternals/2010/04/04/understanding-session-lifetime/
Related videos on Youtube
prototype
Web Developer | Web Designer | Ubuntu 12.04 User | South Park fan | Star Wars fan
Updated on July 09, 2022Comments
-
prototype almost 2 years
For some reason IE11 (only IE11, tested with other IE9 and IE10) won't create a session on a site i've been working on. So this means that a basic functionality such as site login won't work.
On other browsers this is working perfectly.
I researched a bit and found out that IE won't work with domains with underscore.. but my domain doesn't have one so what could be the problem? Thanks!
-
1DMF over 9 yearsDid you find a resolve? I am experiencing the same problem with a member who's IE11 on Win 8 refuses to accept the session cookie,
-
prototype over 9 yearsI haven't found a solution..
-
1DMF over 9 yearsI've added the domain to trusted sites, I've forced acceptance of cookies through the security settings, I've reset the browser, deleted all data, but still IE11 refuses to accept the session cookie. Google Chrome works fine as does FireFox, but IE won't budge.
-
Atherion almost 9 yearsI too am having this problem, already 2 users stating they can't login to my site. Whats going one, I think there is a bug somewhere.
-
Colin R. Turner almost 7 yearsDid we find an answer to this problem? I have the same problem. Tried removing domain attribute and no difference.
-
Chrissi almost 6 yearsUnderscore is not an allowed domain name character according to RFC1035. As such, the hint you've found that IE is not working with one is ... bizarre.
-
-
bebbo almost 7 years@freeworlder can you be more specific? Maybe you have multiple errors in your cookie setting code.
-
Matt Montag over 6 yearsHi @bebbo, do you have a reference to verify your claim?
-
bebbo over 6 years@Matt: it solved the problem in the project I was working.
-
Tushar almost 6 years@bebbo After searching a lot I found this answer and finally this solution worked. Thank you man!
-
leiavoia over 5 yearsMore info: IE11 does accept a domain but it does not accept domains of
localhost
or machine names without a TLD likehttp://myservername/
. It also apparently chokes on subdomains with underscores. See: weblog.west-wind.com/posts/2012/Apr/25/… -
arif.khan.b almost 4 yearsI was struggling to figure out the issue with angular code. Your suggestion helped me resolve this issue thanks
-
s.meijer over 3 yearsThanks @leiavoia! That's it! This had me while debugging an issue on localhost. Adding
127.0.0.1 home.local
to/etc/hosts
and using that domain instead, fixed my issues.