-2

I have an web application which creates username, sessionid cookies while opening the module.

With document.cookie, I am getting the values as "username=xyz, sessionid=123"

On Exiting the application, I am deleting the cookie as below

document.cookie = 'username=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/<%=appName%>';
document.cookie = 'sessionid=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/<%=appName%>';

On re-opening the module, cookie values are again set and getting the values as "username=xyz, sessionid=123"

It is working like this in windows 7 => no issues.

Same steps I followed on Windows 10, First time => for document.cookie, I am getting the values as "username=xyz, sessionid=123" After closing and re-opening the module => for document.cookie, I am getting the values as "username=xyz, sessionid=123, username=, sessionid="

On windows 10, cookies are duplicated, one with value and other is blank. Any idea, why this is happening on windows 10?

I am using IE11 in both machines.

Deepti
  • 85
  • 1
  • 11
  • 1
    What kind of application? Does it run in a browser? Which browsers? The format of the expiration date seems to be invalid. – str Nov 14 '19 at 09:07
  • windows 10 is not a browser - so this question make no sense – Bravo Nov 14 '19 at 09:08
  • Its a web application, I am using IE11 on both win7 and win10 machine. – Deepti Nov 14 '19 at 09:14
  • Oh, so it's an IE11 issue - sorry, can't help, that browsers been dead for many years – Bravo Nov 18 '19 at 03:07
  • @Bravo There are clients who continue to use legacy applications which continue to work on IE11. This issue does not seem to be with browser. – Deepti Nov 18 '19 at 03:49
  • oh, so it also fails in firefox, chrome, safari, opera ....? – Bravo Nov 18 '19 at 04:02
  • application is using applets which do not work on chrome or firefox, therefore we are limited to IE11. – Deepti Nov 18 '19 at 04:24

1 Answers1

0

The problem was expiration date.. 01-Jan-70

Looks like, in windows 7 machine, this expiration date is being taken as 1970 but in windows 10 machine, may be its not considering the value or taking it as 2070. Thats why, instead of updating the cookie value to blank, a new cookie is being created.

Since both machines are using IE11 browser, I am suspecting that the difference in working of cookie expiration date is due to the OS.

Changing the year value to 01-Jan-1970 resolves this issue, and works perfectly on win7 and win10 machine.

document.cookie = 'username=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/<%=appName%>';
document.cookie = 'sessionid=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/<%=appName%>';

Please share if anyone has more information on this.

Deepti
  • 85
  • 1
  • 11